diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcrt/fx_basic_memmgr.cpp | 10 | ||||
-rw-r--r-- | core/fxcrt/fx_memory.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/core/fxcrt/fx_basic_memmgr.cpp b/core/fxcrt/fx_basic_memmgr.cpp index 06568c04ad..f3aaa3678d 100644 --- a/core/fxcrt/fx_basic_memmgr.cpp +++ b/core/fxcrt/fx_basic_memmgr.cpp @@ -11,6 +11,16 @@ pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator; pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator; +void FXMEM_InitalizePartitionAlloc() { + static bool s_gPartitionAllocatorsInitialized = false; + if (!s_gPartitionAllocatorsInitialized) { + pdfium::base::PartitionAllocGlobalInit(FX_OutOfMemoryTerminate); + gArrayBufferPartitionAllocator.init(); + gStringPartitionAllocator.init(); + s_gPartitionAllocatorsInitialized = true; + } +} + void* FXMEM_DefaultAlloc(size_t byte_size, int flags) { return (void*)malloc(byte_size); } diff --git a/core/fxcrt/fx_memory.h b/core/fxcrt/fx_memory.h index c4d619efab..eb369d7d6c 100644 --- a/core/fxcrt/fx_memory.h +++ b/core/fxcrt/fx_memory.h @@ -31,6 +31,7 @@ void FXMEM_DefaultFree(void* pointer, int flags); extern pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator; extern pdfium::base::PartitionAllocatorGeneric gStringPartitionAllocator; +void FXMEM_InitalizePartitionAlloc(); NEVER_INLINE void FX_OutOfMemoryTerminate(); inline void* FX_SafeRealloc(void* ptr, size_t num_members, size_t member_size) { |