diff --git a/CMakeLists.txt b/CMakeLists.txt index 16b925db39..f113a371a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ option(QUIC_BUILD_PERF "Builds the perf code" OFF) option(QUIC_BUILD_SHARED "Builds msquic as a dynamic library" ON) option(QUIC_ENABLE_LOGGING "Enables logging" OFF) option(QUIC_ENABLE_SANITIZERS "Enables sanitizers" OFF) +option(QUIC_ENABLE_POOL_ALLOC "Enables pool allocations" ON) option(QUIC_STATIC_LINK_CRT "Statically links the C runtime" ON) option(QUIC_STATIC_LINK_PARTIAL_CRT "Statically links the compiler-specific portion of the C runtime" ON) option(QUIC_UWP_BUILD "Build for UWP" OFF) @@ -332,7 +333,7 @@ if(QUIC_HIGH_RES_TIMERS) list(APPEND QUIC_COMMON_DEFINES QUIC_HIGH_RES_TIMERS=1) endif() -if (QUIC_ENABLE_SANITIZERS) +if (QUIC_ENABLE_SANITIZERS OR NOT QUIC_ENABLE_POOL_ALLOC) list(APPEND QUIC_COMMON_DEFINES DISABLE_CXPLAT_POOL=1) endif() diff --git a/src/inc/quic_platform_posix.h b/src/inc/quic_platform_posix.h index 10541fb0f0..afa718ebb1 100644 --- a/src/inc/quic_platform_posix.h +++ b/src/inc/quic_platform_posix.h @@ -478,7 +478,11 @@ typedef struct CXPLAT_POOL { } CXPLAT_POOL; +#ifndef DISABLE_CXPLAT_POOL #define CXPLAT_POOL_MAXIMUM_DEPTH 256 // Copied from EX_MAXIMUM_LOOKASIDE_DEPTH_BASE +#else +#define CXPLAT_POOL_MAXIMUM_DEPTH 0 // TODO - Optimize this scenario better +#endif #if DEBUG typedef struct CXPLAT_POOL_ENTRY { diff --git a/src/inc/quic_platform_winuser.h b/src/inc/quic_platform_winuser.h index e5754f4d6a..8295c64f43 100644 --- a/src/inc/quic_platform_winuser.h +++ b/src/inc/quic_platform_winuser.h @@ -319,7 +319,7 @@ typedef struct CXPLAT_POOL { #define CXPLAT_POOL_MAXIMUM_DEPTH 0x4000 // 16384 #define CXPLAT_POOL_DEFAULT_MAX_DEPTH 256 // Copied from EX_MAXIMUM_LOOKASIDE_DEPTH_BASE #else -#define CXPLAT_POOL_MAXIMUM_DEPTH 0 +#define CXPLAT_POOL_MAXIMUM_DEPTH 0 // TODO - Optimize this scenario better #define CXPLAT_POOL_DEFAULT_MAX_DEPTH 0 #endif