Go to the documentation of this file.
58 #define FXMEM_NONLEAVE 1
60 #define FXMEM_MOVABLE 2
62 #define FXMEM_DISCARDABLE 4
72 typedef struct _FXMEM_SystemMgr {
85 void* (*Alloc)(
struct _FXMEM_SystemMgr* pMgr,
size_t size,
int flags);
100 void* (*AllocDebug)(
struct _FXMEM_SystemMgr* pMgr,
size_t size,
int flags,
FX_LPCSTR file,
int line);
114 void* (*Realloc)(
struct _FXMEM_SystemMgr* pMgr,
void* pointer,
size_t size,
int flags);
130 void* (*ReallocDebug)(
struct _FXMEM_SystemMgr* pMgr,
void* pointer,
size_t size,
int flags,
FX_LPCSTR file,
int line);
142 void* (*Lock)(
struct _FXMEM_SystemMgr* pMgr,
void* handle);
154 void (*Unlock)(
struct _FXMEM_SystemMgr* pMgr,
void* handle);
167 void (*Free)(
struct _FXMEM_SystemMgr* pMgr,
void* pointer,
int flags);
179 void (*Purge)(
struct _FXMEM_SystemMgr* pMgr);
190 void (*CollectAll)(
struct _FXMEM_SystemMgr* pMgr);
250 typedef struct _FXMEM_SystemMgr2
262 FX_BOOL (*More)(
struct _FXMEM_SystemMgr2* pMgr,
size_t alloc_size,
void** new_memory,
size_t* new_size);
271 void (*Free)(
struct _FXMEM_SystemMgr2* pMgr,
void* memory);
361 void*
FXMEM_Alloc(FXMEM_FoxitMgr* pFoxitMgr,
size_t size,
int flags);
384 void*
FXMEM_Realloc(FXMEM_FoxitMgr* pFoxitMgr,
void* pointer,
size_t new_size,
int flags);
407 void FXMEM_Free(FXMEM_FoxitMgr* pFoxitMgr,
void* pointer,
int flags);
457 void (*OnAlloc)(FXMEM_FoxitMgr* pMgr,
void* p,
size_t size,
int flags);
473 void (*OnAllocDebug)(FXMEM_FoxitMgr* pMgr,
void* p,
size_t size,
int flags,
FX_LPCSTR file,
int line);
488 void (*OnRealloc)(FXMEM_FoxitMgr* pMgr,
void* old_p,
void* new_p,
size_t size,
int flags);
505 void (*OnReallocDebug)(FXMEM_FoxitMgr* pMgr,
void* old_p,
void* new_p,
size_t size,
int flags,
FX_LPCSTR file,
int line);
518 void (*OnFree)(FXMEM_FoxitMgr* pMgr,
void* p,
int flags);
681 #define FX_Alloc(type, size) (type*)FXMEM_DefaultAllocDebug2(size, sizeof(type), 0, __FILE__, __LINE__)
682 #define FX_Realloc(type, ptr, new_size) (type*)FXMEM_DefaultReallocDebug2(ptr, new_size, sizeof(type), 0, __FILE__, __LINE__)
688 #define FX_Alloc(type, size) (type*)FXMEM_DefaultAlloc2(size, sizeof(type), 0)
693 #define FX_Realloc(type, ptr, size) (type*)FXMEM_DefaultRealloc2(ptr, size, sizeof(type), 0)
697 #define FX_AllocNL(type, size) (type*)FXMEM_DefaultAllocDebug2(size, sizeof(type), FXMEM_NONLEAVE, __FILE__, __LINE__)
698 #define FX_ReallocNL(type, ptr, new_size) (type*)FXMEM_DefaultReallocDebug2(ptr, new_size, sizeof(type), FXMEM_NONLEAVE, __FILE__, __LINE__)
704 #define FX_AllocNL(type, size) (type*)FXMEM_DefaultAlloc2(size, sizeof(type), FXMEM_NONLEAVE)
709 #define FX_ReallocNL(type, ptr, size) (type*)FXMEM_DefaultRealloc2(ptr, size, sizeof(type), FXMEM_NONLEAVE)
713 #define FX_Free(pointer) FXMEM_DefaultFree(pointer, 0)
725 #if __cplusplus >= 201103L
726 #define FX_EQDELETE = delete
727 #define FX_NOEXCEPT noexcept
728 #define FX_EXPLICIT_OPERATOR explicit
730 #define FX_EQDELETE //= delete
731 #define FX_NOEXCEPT //noexcept
732 #define FX_EXPLICIT_OPERATOR //explicit
738 template <
typename T,
typename D = std::default_delete<T>>
739 class CFX_MaybeOwned {
741 CFX_MaybeOwned() : m_pObj(
nullptr) {}
742 explicit CFX_MaybeOwned(T* ptr) : m_pObj(ptr) {}
743 explicit CFX_MaybeOwned(std::unique_ptr<T, D> ptr)
744 : m_pOwnedObj(std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
746 CFX_MaybeOwned(CFX_MaybeOwned&& that) FX_NOEXCEPT
747 : m_pOwnedObj(that.m_pOwnedObj.release()), m_pObj(that.m_pObj) {
748 that.m_pObj =
nullptr;
751 void Reset(std::unique_ptr<T, D> ptr) {
752 m_pOwnedObj = std::move(ptr);
753 m_pObj = m_pOwnedObj.get();
755 void Reset(T* ptr =
nullptr) {
760 bool IsOwned()
const {
return !!m_pOwnedObj; }
761 T* Get()
const {
return m_pObj; }
762 std::unique_ptr<T, D> Release() {
764 return std::move(m_pOwnedObj);
767 CFX_MaybeOwned& operator=(CFX_MaybeOwned&& that) {
768 m_pOwnedObj = std::move(that.m_pOwnedObj);
769 m_pObj = that.m_pObj;
770 that.m_pObj =
nullptr;
773 CFX_MaybeOwned& operator=(T* ptr) {
777 CFX_MaybeOwned& operator=(std::unique_ptr<T, D> ptr) {
778 Reset(std::move(ptr));
782 bool operator==(
const CFX_MaybeOwned& that)
const {
783 return Get() == that.Get();
785 bool operator==(
const std::unique_ptr<T, D>& ptr)
const {
786 return Get() == ptr.get();
788 bool operator==(T* ptr)
const {
return Get() == ptr; }
790 bool operator!=(
const CFX_MaybeOwned& that)
const {
return !(*
this == that); }
791 bool operator!=(
const std::unique_ptr<T, D> ptr)
const {
792 return !(*
this == ptr);
794 bool operator!=(T* ptr)
const {
return !(*
this == ptr); }
796 FX_EXPLICIT_OPERATOR
operator bool()
const {
return !!m_pObj; }
797 T& operator*()
const {
return *m_pObj; }
798 T* operator->()
const {
return m_pObj; }
800 CFX_MaybeOwned(
const CFX_MaybeOwned& that) FX_EQDELETE;
801 CFX_MaybeOwned& operator=(
const CFX_MaybeOwned& that) FX_EQDELETE;
804 std::unique_ptr<T, D> m_pOwnedObj;
809 struct CFX_FreeDeleter {
810 inline void operator()(
void* ptr)
const {
FX_Free(ptr); }
831 void*
operator new (
size_t size,
FX_LPCSTR file,
int line);
832 #ifndef _FX_NO_EXCEPTION_
842 void operator delete (
void* p,
FX_LPCSTR file,
int line);
852 void*
operator new (
size_t size);
860 void operator delete (
void* p);
871 void*
operator new[] (
size_t size,
FX_LPCSTR file,
int line);
872 #ifndef _FX_NO_EXCEPTION_
882 void operator delete[] (
void* p,
FX_LPCSTR file,
int line);
892 void*
operator new[] (
size_t size);
900 void operator delete[] (
void* p);
905 void*
operator new (size_t,
void* buf) {
return buf; }
906 #ifndef _FX_NO_EXCEPTION_
910 void operator delete (
void*,
void*) {}
921 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_) && !defined(__PLACEMENT_NEW_INLINE) && !defined(_MFC_VER) && !defined(_NEW)
922 #define __PLACEMENT_NEW_INLINE
924 inline void*
operator new(
size_t size,
void* pos)
929 inline void operator delete(
void* ptr,
void* pos)
932 #endif //__PLACEMENT_NEW_INLINE
942 #define FX_NEW new(__FILE__, __LINE__)
952 #ifndef _FPDFAPI_MINI_
955 #define FX_NEW_VECTOR(Pointer, Class, Count) Pointer = FX_NEW Class[Count]
957 #define FX_DELETE_VECTOR(Pointer, Class, Count) delete[] Pointer
961 #define FX_NEW_VECTOR(Pointer, Class, Count) \
963 Pointer = FX_Alloc(Class, Count); \
965 for (int i = 0; i < (Count); i ++) new (Pointer + i) Class; \
968 #define FX_DELETE_VECTOR(Pointer, Class, Count) \
970 for (int i = 0; i < (Count); i ++) Pointer[i].~Class(); \
981 class CFX_DestructObject :
public CFX_Object
985 virtual ~CFX_DestructObject() {}
997 typedef struct _IFX_Allocator
1012 void* (*m_AllocDebug)(
struct _IFX_Allocator* pAllocator,
size_t size,
FX_LPCSTR file,
int line);
1024 void* (*m_Alloc)(
struct _IFX_Allocator* pAllocator,
size_t size);
1039 void* (*m_ReallocDebug)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size,
FX_LPCSTR file,
int line);
1052 void* (*m_Realloc)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size);
1064 void (*m_Free)(
struct _IFX_Allocator* pAllocator,
void* p);
1080 #define FX_Allocator_Alloc(fxAllocator, type, size) \
1081 ((fxAllocator) ? (type*)(fxAllocator)->m_AllocDebug((fxAllocator), (size) * sizeof(type), __FILE__, __LINE__) : (FX_Alloc(type, size)))
1083 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \
1084 ((fxAllocator) ? (type*)(fxAllocator)->m_ReallocDebug((fxAllocator), (ptr), (new_size) * sizeof(type), __FILE__, __LINE__) : (FX_Realloc(type, ptr, new_size)))
1087 #define FX_Allocator_Alloc(fxAllocator, type, size) \
1088 ((fxAllocator) ? (type*)(fxAllocator)->m_Alloc((fxAllocator), (size) * sizeof(type)) : (FX_Alloc(type, size)))
1090 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \
1091 ((fxAllocator) ? (type*)(fxAllocator)->m_Realloc((fxAllocator), (ptr), (new_size) * sizeof(type)) : (FX_Realloc(type, ptr, new_size)))
1094 #define FX_Allocator_Free(fxAllocator, ptr) \
1095 ((fxAllocator) ? (fxAllocator)->m_Free((fxAllocator), (ptr)) : (FX_Free(ptr)))
1101 inline void*
operator new(
size_t size,
IFX_Allocator* fxAllocator)
1106 inline void operator delete(
void* ptr,
IFX_Allocator* fxAllocator)
1112 #define FX_NewAtAllocator(fxAllocator) \
1113 ::new(static_cast<IFX_Allocator*>(fxAllocator))
1115 #define FX_DeleteAtAllocator(pointer, fxAllocator, __class__) \
1116 do { (pointer)->~__class__(); ::operator delete(static_cast<void*>(pointer), static_cast<IFX_Allocator*>(fxAllocator)); } while(false)
1123 class CFX_AllocObject
1137 #ifndef _FX_NO_EXCEPTION_
1159 void*
operator new (
size_t size,
IFX_Allocator* pAllocator);
1167 void operator delete (
void* p);
1168 #ifndef _FX_NO_EXCEPTION_
1183 void*
operator new (size_t,
void* buf) {
return buf; }
1184 #ifndef _FX_NO_EXCEPTION_
1188 void operator delete (
void*,
void*) {}
1196 IFX_Allocator* GetAllocator()
const {
return m_pAllocator; }
1209 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator,
FX_LPCSTR file,
int line) {
return operator new(size, pAllocator, file, line); }
1210 #ifndef _FX_NO_EXCEPTION_
1232 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator) {
return operator new(size, pAllocator); }
1240 void operator delete[] (
void* p) {}
1241 #ifndef _FX_NO_EXCEPTION_
1250 void operator delete[] (
void* p,
IFX_Allocator* pAllocator) {}
1261 #define FX_NEWAT(pAllocator) new(pAllocator, __FILE__, __LINE__)
1267 #define FX_NEWAT(pAllocator) new(pAllocator)
1274 #if !defined(_FPDFAPI_MT_NONE_) && !defined(_FPDFAPI_MT_)
1276 #define _FPDFAPI_MT_
1283 class CFX_LockObject :
public CFX_Object
1287 CFX_LockObject() {FX_InitializeCriticalSection(&m_Lock);}
1289 ~CFX_LockObject() {FX_DeleteCriticalSection(&m_Lock);}
1292 FX_BOOL TryLock() {
return FX_TryEnterCriticalSection(&m_Lock);}
1294 void Lock() {FX_EnterCriticalSection(&m_Lock);}
1296 void Unlock() {FX_LeaveCriticalSection(&m_Lock);}
1300 FX_CRITICAL_SECTION m_Lock;
1301 friend class CFX_CSLock;
1311 CFX_CSLock() : m_pCS(
NULL) {}
1313 CFX_CSLock(FX_CRITICAL_SECTION* pCS) : m_pCS(pCS) {
if (m_pCS) FX_EnterCriticalSection(m_pCS);}
1315 CFX_CSLock(CFX_LockObject* pObj) {m_pCS = &pObj->m_Lock; FX_EnterCriticalSection(m_pCS);}
1317 ~CFX_CSLock() {
if (m_pCS) FX_LeaveCriticalSection(m_pCS);}
1320 FX_CRITICAL_SECTION* m_pCS;
1324 #define FXMT_CSLOCK_THIS CFX_CSLock _fx_lock((CFX_LockObject*)this)
1326 #define FXMT_CSLOCK_OBJ(lock) CFX_CSLock _fx_lock((CFX_LockObject*)lock)
1328 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock) CFX_CSLock csLock((CFX_LockObject*)lock)
1331 #define FXMT_LOCKOBJECT_DEFINE(lockObj) CFX_LockObject lockObj
1333 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj) (lockObj)->TryLock()
1335 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if ((lockObj)->TryLock())
1337 #define FXMT_LOCKOBJECT_LOCK(lockObj) (lockObj)->Lock()
1339 #define FXMT_LOCKOBJECT_UNLOCK(lockObj) (lockObj)->Unlock()
1341 class CFX_LockObject : public CFX_Object {};
1342 #define FXMT_CSLOCK_THIS
1343 #define FXMT_CSLOCK_OBJ(lock)
1344 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock)
1346 #define FXMT_LOCKOBJECT_DEFINE(lockObj)
1347 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj)
1348 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if (1)
1349 #define FXMT_LOCKOBJECT_LOCK(lockObj)
1350 #define FXMT_LOCKOBJECT_UNLOCK(lockObj)
1361 class CFX_GrowOnlyPool :
public IFX_Allocator,
public CFX_Object
1378 ~CFX_GrowOnlyPool();
1396 void SetTrunkSize(
size_t trunk_size) { m_TrunkSize = trunk_size; }
1407 void* AllocDebug(
size_t size,
FX_LPCSTR file,
int line) {
return Alloc(size); }
1415 void* Alloc(
size_t size);
1423 void* ReallocDebug(
void* p,
size_t new_size,
FX_LPCSTR file,
int line) {
return NULL; }
1431 void* Realloc(
void* p,
size_t new_size) {
return NULL; }
1437 void Free(
void* mem) {}
1450 void* m_pFirstTrunk;
1455 FX_CRITICAL_SECTION m_Lock;
1461 template <
class T>
class AllocProxy :
public CFX_Object {
1463 AllocProxy(
size_t size) { buffer = (T *)
FX_Alloc(T, size); }
1464 ~AllocProxy() {
if (buffer)
FX_Free(buffer); }
1465 T &operator[](
int index) {
return buffer[index]; }
1466 operator T *() {
return buffer; }
1467 T *
operator +(
int offset) {
return buffer + offset; }
1468 operator bool()
const {
return !!buffer; }
1469 T *operator->()
const {
return buffer; }
1472 AllocProxy(
const AllocProxy &) {}
1473 AllocProxy &operator=(
const AllocProxy &) {}
1479 struct CFX_ReleaseDeleter {
1480 inline void operator()(T* ptr)
const { ptr->Release(); }
1486 #endif //__cplusplus
1496 #define _FXMEM_NO64_
1500 #define FX_FIXEDMEM_PAGESIZE (4096 * 16)
1502 #define FX_FIXEDMEM_MIDBLOCKSIZE (4096)
1505 typedef struct _FX_MEMCONFIG
1513 #if !defined(_FXMEM_NO64_)
1514 size_t nPageNum_Init64;
1520 #if !defined(_FXMEM_NO64_)
1521 size_t nPageNum_More64;
1523 #if defined(_FXMEM_LIT_)
1524 size_t nPageSize_Lit;
1525 size_t nPageNum_InitLit;
1526 size_t nPageNum_MoreLit;
1527 size_t nPageNum_ReservedLit;
1555 #if defined(_FX_MEMSTATE_)
1557 typedef struct _FX_MEMPAGESTATE_
1562 size_t nCurAvailSize;
1563 size_t nMinAvailSize;
1564 size_t nMaxAvailSize;
1565 size_t nCurUsedSize;
1566 size_t nMinUsedSize;
1567 size_t nMaxUsedSize;
1568 size_t nCurUsedRate;
1569 size_t nMinUsedRate;
1570 size_t nMaxUsedRate;
1573 typedef struct _FX_MEMINFO_
1575 size_t memBlockCount[64];
1576 FX_MEMPAGESTATE pageState8;
1577 FX_MEMPAGESTATE pageState16;
1578 FX_MEMPAGESTATE pageState32;
1579 FX_MEMPAGESTATE pageStateMid;
1580 FX_MEMPAGESTATE pageStateLarge;
1581 FX_MEMPAGESTATE totalState;
1584 #define FX_MEMSTATE_RATEFRACTION 100000
1586 void FX_MemState_MergeInfo(FX_MEMINFO *mi1,
const FX_MEMINFO *mi2);
1587 FX_MEMINFO* FX_MemState_GetInfo();
1588 void FX_MemState_ResetInfo();
1590 #endif //_FX_MEMSTATE_
1599 #endif //_FX_MEMORY_H_
unsigned char FX_BYTE
Byte (8 bits).
Definition: fx_system.h:656
void * FXMEM_AllocDebug(FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags, FX_LPCSTR file, int line)
Foxit basic memory allocation function in debug-mode.
IFX_Allocator * FXMEM_GetDefAllocator()
Get default allocator used by the library.
size_t nPageNum_Init16
Initial number of memory pages for 16-bytes fixed data size. 8 for desktop platforms,...
Definition: fx_memory.h:1510
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...
int FXMEM_SetPyConfig(size_t lowByteRange, size_t highByteRange)
Set configuration of Python memory.
size_t nPageNum_Init8
Initial number of memory pages for 8-bytes fixed data size. 1 for desktop platforms,...
Definition: fx_memory.h:1508
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.
#define FX_Free(pointer)
A macro for Foxit memory free operation.
Definition: fx_memory.h:713
size_t nPageSize_Mid
Size of memory pages for middle data range (> 32-bytes & <= FX_FIXEDMEM_MIDBLOCKSIZE)....
Definition: fx_memory.h:1530
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.
size_t nPageNum_More16
More number of memory pages for 16-bytes fixed data size. 8 for desktop platforms,...
Definition: fx_memory.h:1517
Fixed memory manager.
Definition: fx_memory.h:250
void FXMEM_CollectAll(FXMEM_FoxitMgr *pFoxitMgr)
Release all memory blocks allocated by a Foxit manager. This function is only supported on embedded s...
void FXMEM_DestroyFoxitMgr(FXMEM_FoxitMgr *pFoxitMgr)
Destroy a Foxit manager instance. If the platform supports auto-collection, then all allocated memory...
void FXMEM_OutputDebugTag(FXMEM_FoxitMgr *pFoxitMgr, FX_LPCSTR tag)
Output a memory debug tag.
#define FX_Alloc(type, size)
A macro for Foxit memory allocation operation.
Definition: fx_memory.h:688
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:760
void * FXMEM_DefaultAlloc2(size_t units, size_t unit_size, int flags)
Default allocation function using default Foxit memory manager for current module.
#define FX_Allocator_Alloc(fxAllocator, type, size)
Release-mode allocation on an allocator.
Definition: fx_memory.h:1087
void * user
A generic typeless pointer for user data.
Definition: fx_memory.h:193
size_t nPageSize_Large
Minimum size of memory page for large data (> FX_FIXEDMEM_MIDBLOCKSIZE). 128 for desktop platforms,...
Definition: fx_memory.h:1536
Foxit allocator interface.
Definition: fx_memory.h:997
void FXMEM_SetConfig(const FX_MEMCONFIG *memConfig)
Set configuration of fixed memory.
Header file for system related definitions.
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:128
CFX_ByteString operator+(FX_BSTR str1, FX_BSTR str2)
Concatenate a non-buffered byte string and a non-buffered byte string.
Definition: fx_string.h:971
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:696
void * FXMEM_DefaultRealloc(void *pointer, size_t new_size, int flags)
Default reallocation function using default Foxit memory manager for current module.
size_t nPageSize_Alone
Minimum size of alone memory page for large data. 64 for desktop platforms, 64 for limited memory env...
Definition: fx_memory.h:1538
FXMEM_FoxitMgr * FXMEM_CreateFixedMgr(void *pMemory, size_t size, FXMEM_SystemMgr2 *pExtender)
Create a Foxit manager from a pre-allocated, fixed memory buffer.
FXMEM_FoxitMgr * FXMEM_CreatePyMgr()
Create a Python manager. A fast, special-purpose memory allocator for small blocks,...
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.
void(* FPDF_OOM_Handler)(FXMEM_FoxitMgr *pFoxitMgr, void *param)
the prototype of the Out-Of-Memory handler.
Definition: fx_memory.h:561
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:140
void FXMEM_ResetSystemMgr()
Reset Foxit system memory manager for current module.
void FXMEM_DefaultFree(void *pointer, int flags)
Default free function using default Foxit memory manager for current module.
#define NULL
The null-pointer value.
Definition: fx_system.h:780
void FXMEM_ReportOOM(FXMEM_FoxitMgr *pFoxitMgr)
Report Out-of-memory (OOM).
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:682
System level memory manager. Application can implement their own system memory manager.
Definition: fx_memory.h:72
#define FX_Allocator_Free(fxAllocator, ptr)
Free memory block on an allocator.
Definition: fx_memory.h:1094
Memory debugger interface. All functions must be implemented.
Definition: fx_memory.h:443
void FXMEM_Free(FXMEM_FoxitMgr *pFoxitMgr, void *pointer, int flags)
Foxit basic memory free function.
#define ASSERT(a)
Assertion for debug mode, do nothing for release mode.
Definition: fx_system.h:807
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.
void FXMEM_PurgeMgr(FXMEM_FoxitMgr *pFoxitMgr)
Release all excessive memory without touching any used memory. This is useful for extensible fixed me...
void * FXMEM_Realloc(FXMEM_FoxitMgr *pFoxitMgr, void *pointer, size_t new_size, int flags)
Foxit basic memory reallocation function.
size_t nPageNum_Init32
Initial number of memory pages for 32-bytes fixed data size. 24 for desktop platforms,...
Definition: fx_memory.h:1512
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.
void FXMEM_SetOOMHandler(FXMEM_FoxitMgr *pFoxitMgr, FPDF_OOM_Handler pOOMReportFunc, void *param)
Setup A Out-Of-Memory handler for a Foxit memory manager.
FXMEM_FoxitMgr * FXMEM_CreateMemoryMgr(size_t size, FX_BOOL extensible)
Create a fixed memory manager as default implementation.
size_t nPageNum_More32
More number of memry pages for 32-bytes fixed data size. 24 for desktop platforms,...
Definition: fx_memory.h:1519
size_t nPageNum_MoreMid
More number of memory pages for middle data range. 4 for desktop platforms, 4 for limited memory envi...
Definition: fx_memory.h:1534
void * FXMEM_Alloc(FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags)
Foxit basic memory allocation function.
size_t nPageNum_InitMid
Initial number of memory pages for middle data range. 2 for desktop platforms, 2 for limited memory e...
Definition: fx_memory.h:1532
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.
void * FXMEM_DefaultAlloc(size_t byte_size, int flags)
Default allocation function using default Foxit memory manager for current module.
size_t FXMEM_GetBlockSizeInFixedMgr(FXMEM_FoxitMgr *pFoxitMgr, void *ptr)
Get the size of a memory block to which ptr points.
FXMEM_FoxitMgr * FXMEM_GetDefaultMgr()
Get default memory manager for current module.
Structure of fixed memory configuration.
Definition: fx_memory.h:1505
void FXMEM_SetDefaultMgr(FXMEM_FoxitMgr *pFoxitMgr)
Set default Foxit manager for current compile module (EXE, DLL, etc.).
FXMEM_FoxitMgr * FXMEM_CreateFoxitMgr(FXMEM_SystemMgr *pSystemMgr)
Create a Foxit manager. A system manager must be provided for actual allocation.
@2024 Foxit Software Incorporated. All rights reserved.