Foxit PDF SDK

Classes | Macros | Functions
fx_memory.h File Reference

Header file for Memory management related definitions and classes. More...

Go to the source code of this file.

## Classes
struct | FXMEM_FoxitMgr
| Foxit memory manager. More...
struct | FX_MEMCONFIG
| Structure of fixed memory configuration. More...
struct | FXMEM_Debugger
| Memory debugger interface. All functions must be implemented. More...
struct | FXMEM_SystemMgr
| System level memory manager. Application can implement their own system memory manager. More...
struct | FXMEM_SystemMgr2
| Fixed memory manager. More...
struct | IFX_Allocator
| Foxit allocator interface. More...

## Macros
#define | FXMEM_DISCARDABLE 4
| Flag for allocate discardable memory.
#define | FXMEM_MOVABLE 2
| Flag for allocate movable memory.
#define | FXMEM_NONLEAVE 1
| Flag for no calling OOM-handler when memory allocation failed.

## Functions
FXMEM_FoxitMgr * | FXMEM_CreateFixedMgr (void *pMemory, size_t size, FXMEM_SystemMgr2 *pExtender)
| Create a Foxit manager from a pre-allocated, fixed memory buffer. More...
FXMEM_FoxitMgr * | FXMEM_CreateFoxitMgr (FXMEM_SystemMgr *pSystemMgr)
| Create a Foxit manager. A system manager must be provided for actual allocation. More...
FXMEM_FoxitMgr * | FXMEM_CreateMemoryMgr (size_t size, FX_BOOL extensible)
| Create a fixed memory manager as default implementation. More...
FXMEM_FoxitMgr * | FXMEM_CreatePyMgr ()
| Create a Python manager. A fast, special-purpose memory allocator for small blocks, to be used on top of a general-purpose malloc – heavily based on previous art. More...
void | FXMEM_DestroyFoxitMgr (FXMEM_FoxitMgr *pFoxitMgr)
| Destroy a Foxit manager instance. If the platform supports auto-collection, then all allocated memory blocks will be released. More...
size_t | FXMEM_GetBlockSizeInFixedMgr (FXMEM_FoxitMgr *pFoxitMgr, void *ptr)
| Get the size of a memory block to which ptr points. More...
FXMEM_FoxitMgr * | FXMEM_GetDefaultMgr ()
| Get default memory manager for current module. More...
void | FXMEM_ResetSystemMgr ()
| Reset Foxit system memory manager for current module. More...
void | FXMEM_SetDefaultMgr (FXMEM_FoxitMgr *pFoxitMgr)
| Set default Foxit manager for current compile module (EXE, DLL, etc.). More...
int | FXMEM_SetPyConfig (size_t lowByteRange, size_t highByteRange)
| Set configuration of Python memory. More...

## Basic memory operations
typedef void(* | FPDF_OOM_Handler) (FXMEM_FoxitMgr *pFoxitMgr, void *param)
| the prototype of the Out-Of-Memory handler. More...
void * | FXMEM_Alloc (FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags)
| Foxit basic memory allocation function. More...
void * | FXMEM_AllocDebug (FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags, FX_LPCSTR file, int line)
| Foxit basic memory allocation function in debug-mode. More...
void | FXMEM_CollectAll (FXMEM_FoxitMgr *pFoxitMgr)
| Release all memory blocks allocated by a Foxit manager. This function is only supported on embedded systems. More...
void | FXMEM_Free (FXMEM_FoxitMgr *pFoxitMgr, void *pointer, int flags)
| Foxit basic memory free function. More...
void | FXMEM_OutputDebugTag (FXMEM_FoxitMgr *pFoxitMgr, FX_LPCSTR tag)
| Output a memory debug tag. More...
void | FXMEM_PurgeMgr (FXMEM_FoxitMgr *pFoxitMgr)
| Release all excessive memory without touching any used memory. This is useful for extensible fixed memory manager (FXMEM_SystemMgr2), because we never free those additional memory pool until the memory manager destroyed. More...
void * | FXMEM_Realloc (FXMEM_FoxitMgr *pFoxitMgr, void *pointer, size_t new_size, int flags)
| Foxit basic memory reallocation function. More...
void * | FXMEM_ReallocDebug (FXMEM_FoxitMgr *pFoxitMgr, void *pointer, size_t new_size, int flags, FX_LPCSTR file, int line)
| Foxit basic memory reallocation function in debug-mode. More...
void | FXMEM_ReportOOM (FXMEM_FoxitMgr *pFoxitMgr)
| Report Out-of-memory (OOM). More...
void | FXMEM_SetOOMHandler (FXMEM_FoxitMgr *pFoxitMgr, FPDF_OOM_Handler pOOMReportFunc, void *param)
| Setup A Out-Of-Memory handler for a Foxit memory manager. More...
void | FXMEM_UseDebugger (FXMEM_FoxitMgr *pFoxitMgr, FXMEM_Debugger *pDebugger)
| Use a memory debugger which capturing all memory activities. Use NULL for parameter pDebugger to stop debugging. More...

## Following base memory functions use default Foxit manager for current module
#define | _FXMEM_NO64_
#define | FX_Alloc(type, size)
| A macro for Foxit memory allocation operation.
#define | FX_Allocator_Alloc(fxAllocator, type, size) ((fxAllocator) ? (type*)(fxAllocator)->m_Alloc((fxAllocator), (size) * sizeof(type)) : (FX_Alloc(type, size)))
| Release-mode allocation on an allocator.
#define | FX_Allocator_Free(fxAllocator, ptr) ((fxAllocator) ? (fxAllocator)->m_Free((fxAllocator), (ptr)) : (FX_Free(ptr)))
| Free memory block on an allocator.
#define | FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) ((fxAllocator) ? (type*)(fxAllocator)->m_Realloc((fxAllocator), (ptr), (new_size) * sizeof(type)) : (FX_Realloc(type, ptr, new_size)))
| Release-mode re-allocation on an allocator.
#define | FX_AllocNL(type, size)
| A macro for Foxit memory allocation operation with non-leaving (return NULL if OOM).
#define | FX_FIXEDMEM_MIDBLOCKSIZE (4096)
| Size of middle data block, 4KB.
#define | FX_FIXEDMEM_PAGESIZE (4096 * 16)
| Size of memory page, 64KB.
#define | FX_Free(pointer) FXMEM_DefaultFree(pointer, 0)
| A macro for Foxit memory free operation.
#define | FX_Realloc(type, ptr, size)
| A macro for Foxit memory reallocation operation.
#define | FX_ReallocNL(type, ptr, size)
| A macro for Foxit memory reallocation operation with non-leaving (return NULL if OOM).
void * | FXMEM_DefaultAlloc (size_t byte_size, int flags)
| Default allocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultAlloc2 (size_t units, size_t unit_size, int flags)
| Default allocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultAllocDebug (size_t size, int flags, FX_LPCSTR file, int line)
| Default debug-mode allocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultAllocDebug2 (size_t units, size_t unit_size, int flags, FX_LPCSTR file, int line)
| Default debug-mode allocation function using default Foxit memory manager for current module. More...
void | FXMEM_DefaultFree (void *pointer, int flags)
| Default free function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultRealloc (void *pointer, size_t new_size, int flags)
| Default reallocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultRealloc2 (void *pointer, size_t units, size_t unit_size, int flags)
| Default reallocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultReallocDebug (void *pointer, size_t new_size, int flags, FX_LPCSTR file, int line)
| Default debug-mode reallocation function using default Foxit memory manager for current module. More...
void * | FXMEM_DefaultReallocDebug2 (void *pointer, size_t units, size_t unit_size, int flags, FX_LPCSTR file, int line)
| Default debug-mode reallocation function using default Foxit memory manager for current module. More...
IFX_Allocator * | FXMEM_GetDefAllocator ()
| Get default allocator used by the library. More...
void | FXMEM_SetConfig (const FX_MEMCONFIG *memConfig)
| Set configuration of fixed memory. More...

## Detailed Description

Header file for Memory management related definitions and classes.

Copyright (C) 2003-2026, Foxit Software Inc.. All Rights Reserved.

http://www.foxitsoftware.com

The following code is copyrighted and is the proprietary of Foxit Software Inc.. It is not allowed to distribute any parts of Foxit PDF SDK to third party or public without permission unless an agreement is signed between Foxit Software Inc. and customers to explicitly grant customers permissions.