Skip to content

Commit

Permalink
Better Support for Disabling Pool Allocations (#4539)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks committed Sep 9, 2024
1 parent add8a3a commit 376265a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions src/inc/quic_platform_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/inc/quic_platform_winuser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 376265a

Please sign in to comment.