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);
220 typedef struct _FXMEM_SystemMgr2
232 FX_BOOL (*More)(
struct _FXMEM_SystemMgr2* pMgr,
size_t alloc_size,
void** new_memory,
size_t* new_size);
241 void (*Free)(
struct _FXMEM_SystemMgr2* pMgr,
void* memory);
324 void*
FXMEM_Alloc(FXMEM_FoxitMgr* pFoxitMgr,
size_t size,
int flags);
347 void*
FXMEM_Realloc(FXMEM_FoxitMgr* pFoxitMgr,
void* pointer,
size_t new_size,
int flags);
370 void FXMEM_Free(FXMEM_FoxitMgr* pFoxitMgr,
void* pointer,
int flags);
420 void (*OnAlloc)(FXMEM_FoxitMgr* pMgr,
void* p,
size_t size,
int flags);
436 void (*OnAllocDebug)(FXMEM_FoxitMgr* pMgr,
void* p,
size_t size,
int flags,
FX_LPCSTR file,
int line);
451 void (*OnRealloc)(FXMEM_FoxitMgr* pMgr,
void* old_p,
void* new_p,
size_t size,
int flags);
468 void (*OnReallocDebug)(FXMEM_FoxitMgr* pMgr,
void* old_p,
void* new_p,
size_t size,
int flags,
FX_LPCSTR file,
int line);
481 void (*OnFree)(FXMEM_FoxitMgr* pMgr,
void* p,
int flags);
644 #define FX_Alloc(type, size) (type*)FXMEM_DefaultAllocDebug2(size, sizeof(type), 0, __FILE__, __LINE__) 645 #define FX_Realloc(type, ptr, new_size) (type*)FXMEM_DefaultReallocDebug2(ptr, new_size, sizeof(type), 0, __FILE__, __LINE__) 651 #define FX_Alloc(type, size) (type*)FXMEM_DefaultAlloc2(size, sizeof(type), 0) 656 #define FX_Realloc(type, ptr, size) (type*)FXMEM_DefaultRealloc2(ptr, size, sizeof(type), 0) 660 #define FX_AllocNL(type, size) (type*)FXMEM_DefaultAllocDebug2(size, sizeof(type), FXMEM_NONLEAVE, __FILE__, __LINE__) 661 #define FX_ReallocNL(type, ptr, new_size) (type*)FXMEM_DefaultReallocDebug2(ptr, new_size, sizeof(type), FXMEM_NONLEAVE, __FILE__, __LINE__) 667 #define FX_AllocNL(type, size) (type*)FXMEM_DefaultAlloc2(size, sizeof(type), FXMEM_NONLEAVE) 672 #define FX_ReallocNL(type, ptr, size) (type*)FXMEM_DefaultRealloc2(ptr, size, sizeof(type), FXMEM_NONLEAVE) 676 #define FX_Free(pointer) FXMEM_DefaultFree(pointer, 0) 688 #if __cplusplus >= 201103L 689 #define FX_EQDELETE = delete 690 #define FX_NOEXCEPT noexcept 691 #define FX_EXPLICIT_OPERATOR explicit 693 #define FX_EQDELETE //= delete 694 #define FX_NOEXCEPT //noexcept 695 #define FX_EXPLICIT_OPERATOR //explicit 701 template <
typename T,
typename D = std::default_delete<T>>
702 class CFX_MaybeOwned {
704 CFX_MaybeOwned() : m_pObj(
nullptr) {}
705 explicit CFX_MaybeOwned(T* ptr) : m_pObj(ptr) {}
706 explicit CFX_MaybeOwned(std::unique_ptr<T, D> ptr)
707 : m_pOwnedObj(
std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
709 CFX_MaybeOwned(CFX_MaybeOwned&& that) FX_NOEXCEPT
710 : m_pOwnedObj(that.m_pOwnedObj.release()), m_pObj(that.m_pObj) {
711 that.m_pObj =
nullptr;
714 void Reset(std::unique_ptr<T, D> ptr) {
715 m_pOwnedObj = std::move(ptr);
716 m_pObj = m_pOwnedObj.get();
718 void Reset(T* ptr =
nullptr) {
723 bool IsOwned()
const {
return !!m_pOwnedObj; }
724 T* Get()
const {
return m_pObj; }
725 std::unique_ptr<T, D> Release() {
727 return std::move(m_pOwnedObj);
730 CFX_MaybeOwned& operator=(CFX_MaybeOwned&& that) {
731 m_pOwnedObj = std::move(that.m_pOwnedObj);
732 m_pObj = that.m_pObj;
733 that.m_pObj =
nullptr;
736 CFX_MaybeOwned& operator=(T* ptr) {
740 CFX_MaybeOwned& operator=(std::unique_ptr<T, D> ptr) {
741 Reset(std::move(ptr));
745 bool operator==(
const CFX_MaybeOwned& that)
const {
746 return Get() == that.Get();
748 bool operator==(
const std::unique_ptr<T, D>& ptr)
const {
749 return Get() == ptr.get();
751 bool operator==(T* ptr)
const {
return Get() == ptr; }
753 bool operator!=(
const CFX_MaybeOwned& that)
const {
return !(*
this == that); }
754 bool operator!=(
const std::unique_ptr<T, D> ptr)
const {
755 return !(*
this == ptr);
757 bool operator!=(T* ptr)
const {
return !(*
this == ptr); }
759 FX_EXPLICIT_OPERATOR
operator bool()
const {
return !!m_pObj; }
760 T& operator*()
const {
return *m_pObj; }
761 T* operator->()
const {
return m_pObj; }
763 CFX_MaybeOwned(
const CFX_MaybeOwned& that) FX_EQDELETE;
764 CFX_MaybeOwned& operator=(
const CFX_MaybeOwned& that) FX_EQDELETE;
767 std::unique_ptr<T, D> m_pOwnedObj;
772 struct CFX_FreeDeleter {
773 inline void operator()(
void* ptr)
const {
FX_Free(ptr); }
794 void*
operator new (
size_t size,
FX_LPCSTR file,
int line);
795 #ifndef _FX_NO_EXCEPTION_ 805 void operator delete (
void* p,
FX_LPCSTR file,
int line);
815 void*
operator new (
size_t size);
823 void operator delete (
void* p);
834 void*
operator new[] (
size_t size,
FX_LPCSTR file,
int line);
835 #ifndef _FX_NO_EXCEPTION_ 845 void operator delete[] (
void* p,
FX_LPCSTR file,
int line);
855 void*
operator new[] (
size_t size);
863 void operator delete[] (
void* p);
868 void*
operator new (size_t,
void* buf) {
return buf; }
869 #ifndef _FX_NO_EXCEPTION_ 873 void operator delete (
void*,
void*) {}
884 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_) && !defined(__PLACEMENT_NEW_INLINE) && !defined(_MFC_VER) && !defined(_NEW) 885 #define __PLACEMENT_NEW_INLINE 887 inline void*
operator new(
size_t size,
void* pos)
892 inline void operator delete(
void* ptr,
void* pos)
895 #endif //__PLACEMENT_NEW_INLINE 905 #define FX_NEW new(__FILE__, __LINE__) 915 #ifndef _FPDFAPI_MINI_ 918 #define FX_NEW_VECTOR(Pointer, Class, Count) Pointer = FX_NEW Class[Count] 920 #define FX_DELETE_VECTOR(Pointer, Class, Count) delete[] Pointer 924 #define FX_NEW_VECTOR(Pointer, Class, Count) \ 926 Pointer = FX_Alloc(Class, Count); \ 928 for (int i = 0; i < (Count); i ++) new (Pointer + i) Class; \ 931 #define FX_DELETE_VECTOR(Pointer, Class, Count) \ 933 for (int i = 0; i < (Count); i ++) Pointer[i].~Class(); \ 944 class CFX_DestructObject :
public CFX_Object
948 virtual ~CFX_DestructObject() {}
960 typedef struct _IFX_Allocator
975 void* (*m_AllocDebug)(
struct _IFX_Allocator* pAllocator,
size_t size,
FX_LPCSTR file,
int line);
987 void* (*m_Alloc)(
struct _IFX_Allocator* pAllocator,
size_t size);
1002 void* (*m_ReallocDebug)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size,
FX_LPCSTR file,
int line);
1015 void* (*m_Realloc)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size);
1027 void (*m_Free)(
struct _IFX_Allocator* pAllocator,
void* p);
1043 #define FX_Allocator_Alloc(fxAllocator, type, size) \ 1044 ((fxAllocator) ? (type*)(fxAllocator)->m_AllocDebug((fxAllocator), (size) * sizeof(type), __FILE__, __LINE__) : (FX_Alloc(type, size))) 1046 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \ 1047 ((fxAllocator) ? (type*)(fxAllocator)->m_ReallocDebug((fxAllocator), (ptr), (new_size) * sizeof(type), __FILE__, __LINE__) : (FX_Realloc(type, ptr, new_size))) 1050 #define FX_Allocator_Alloc(fxAllocator, type, size) \ 1051 ((fxAllocator) ? (type*)(fxAllocator)->m_Alloc((fxAllocator), (size) * sizeof(type)) : (FX_Alloc(type, size))) 1053 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \ 1054 ((fxAllocator) ? (type*)(fxAllocator)->m_Realloc((fxAllocator), (ptr), (new_size) * sizeof(type)) : (FX_Realloc(type, ptr, new_size))) 1057 #define FX_Allocator_Free(fxAllocator, ptr) \ 1058 ((fxAllocator) ? (fxAllocator)->m_Free((fxAllocator), (ptr)) : (FX_Free(ptr))) 1064 inline void*
operator new(
size_t size,
IFX_Allocator* fxAllocator)
1069 inline void operator delete(
void* ptr,
IFX_Allocator* fxAllocator)
1075 #define FX_NewAtAllocator(fxAllocator) \ 1076 ::new(static_cast<IFX_Allocator*>(fxAllocator)) 1078 #define FX_DeleteAtAllocator(pointer, fxAllocator, __class__) \ 1079 do { if (!(pointer)) break; (pointer)->~__class__(); ::operator delete(static_cast<void*>(pointer), static_cast<IFX_Allocator*>(fxAllocator)); } while(false) 1086 class CFX_AllocObject
1100 #ifndef _FX_NO_EXCEPTION_ 1122 void*
operator new (
size_t size,
IFX_Allocator* pAllocator);
1130 void operator delete (
void* p);
1131 #ifndef _FX_NO_EXCEPTION_ 1146 void*
operator new (size_t,
void* buf) {
return buf; }
1147 #ifndef _FX_NO_EXCEPTION_ 1151 void operator delete (
void*,
void*) {}
1159 IFX_Allocator* GetAllocator()
const {
return m_pAllocator; }
1172 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator,
FX_LPCSTR file,
int line) {
return operator new(size, pAllocator, file, line); }
1173 #ifndef _FX_NO_EXCEPTION_ 1195 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator) {
return operator new(size, pAllocator); }
1203 void operator delete[] (
void* p) {}
1204 #ifndef _FX_NO_EXCEPTION_ 1213 void operator delete[] (
void* p,
IFX_Allocator* pAllocator) {}
1224 #define FX_NEWAT(pAllocator) new(pAllocator, __FILE__, __LINE__) 1230 #define FX_NEWAT(pAllocator) new(pAllocator) 1237 #if !defined(_FPDFAPI_MT_NONE_) && !defined(_FPDFAPI_MT_) 1239 #define _FPDFAPI_MT_ 1246 class CFX_LockObject :
public CFX_Object
1250 CFX_LockObject() {FX_InitializeCriticalSection(&m_Lock);}
1252 ~CFX_LockObject() {FX_DeleteCriticalSection(&m_Lock);}
1255 FX_BOOL TryLock() {
return FX_TryEnterCriticalSection(&m_Lock);}
1257 void Lock() {FX_EnterCriticalSection(&m_Lock);}
1259 void Unlock() {FX_LeaveCriticalSection(&m_Lock);}
1263 FX_CRITICAL_SECTION m_Lock;
1264 friend class CFX_CSLock;
1274 CFX_CSLock() : m_pCS(
NULL) {}
1276 CFX_CSLock(FX_CRITICAL_SECTION* pCS) : m_pCS(pCS) {
if (m_pCS) FX_EnterCriticalSection(m_pCS);}
1278 CFX_CSLock(CFX_LockObject* pObj) {m_pCS = &pObj->m_Lock; FX_EnterCriticalSection(m_pCS);}
1280 ~CFX_CSLock() {
if (m_pCS) FX_LeaveCriticalSection(m_pCS);}
1283 FX_CRITICAL_SECTION* m_pCS;
1287 #define FXMT_CSLOCK_THIS CFX_CSLock _fx_lock((CFX_LockObject*)this) 1289 #define FXMT_CSLOCK_OBJ(lock) CFX_CSLock _fx_lock((CFX_LockObject*)lock) 1291 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock) CFX_CSLock csLock((CFX_LockObject*)lock) 1294 #define FXMT_LOCKOBJECT_DEFINE(lockObj) CFX_LockObject lockObj 1296 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj) (lockObj)->TryLock() 1298 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if ((lockObj)->TryLock()) 1300 #define FXMT_LOCKOBJECT_LOCK(lockObj) (lockObj)->Lock() 1302 #define FXMT_LOCKOBJECT_UNLOCK(lockObj) (lockObj)->Unlock() 1304 class CFX_LockObject : public CFX_Object {}; 1305 #define FXMT_CSLOCK_THIS 1306 #define FXMT_CSLOCK_OBJ(lock) 1307 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock) 1309 #define FXMT_LOCKOBJECT_DEFINE(lockObj) 1310 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj) 1311 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if (1) 1312 #define FXMT_LOCKOBJECT_LOCK(lockObj) 1313 #define FXMT_LOCKOBJECT_UNLOCK(lockObj) 1324 class CFX_GrowOnlyPool :
public IFX_Allocator,
public CFX_Object
1341 ~CFX_GrowOnlyPool();
1359 void SetTrunkSize(
size_t trunk_size) { m_TrunkSize = trunk_size; }
1370 void* AllocDebug(
size_t size,
FX_LPCSTR file,
int line) {
return Alloc(size); }
1378 void* Alloc(
size_t size);
1386 void* ReallocDebug(
void* p,
size_t new_size,
FX_LPCSTR file,
int line) {
return NULL; }
1394 void* Realloc(
void* p,
size_t new_size) {
return NULL; }
1400 void Free(
void* mem) {}
1413 void* m_pFirstTrunk;
1418 FX_CRITICAL_SECTION m_Lock;
1424 template <
class T>
class AllocProxy :
public CFX_Object {
1426 AllocProxy(
size_t size) { buffer = (T *)
FX_Alloc(T, size); }
1427 ~AllocProxy() {
if (buffer)
FX_Free(buffer); }
1428 T &operator[](
int index) {
return buffer[index]; }
1429 operator T *() {
return buffer; }
1430 T *
operator +(
int offset) {
return buffer + offset; }
1431 operator bool()
const {
return !!buffer; }
1432 T *operator->()
const {
return buffer; }
1435 AllocProxy(
const AllocProxy &) {}
1436 AllocProxy &operator=(
const AllocProxy &) {}
1442 struct CFX_ReleaseDeleter {
1443 inline void operator()(T* ptr)
const { ptr->Release(); }
1449 #endif //__cplusplus 1459 #define _FXMEM_NO64_ 1463 #define FX_FIXEDMEM_PAGESIZE (4096 * 16) 1465 #define FX_FIXEDMEM_MIDBLOCKSIZE (4096) 1468 typedef struct _FX_MEMCONFIG
1476 #if !defined(_FXMEM_NO64_) 1477 size_t nPageNum_Init64;
1483 #if !defined(_FXMEM_NO64_) 1484 size_t nPageNum_More64;
1486 #if defined(_FXMEM_LIT_) 1487 size_t nPageSize_Lit;
1488 size_t nPageNum_InitLit;
1489 size_t nPageNum_MoreLit;
1490 size_t nPageNum_ReservedLit;
1518 #if defined(_FX_MEMSTATE_) 1520 typedef struct _FX_MEMPAGESTATE_
1525 size_t nCurAvailSize;
1526 size_t nMinAvailSize;
1527 size_t nMaxAvailSize;
1528 size_t nCurUsedSize;
1529 size_t nMinUsedSize;
1530 size_t nMaxUsedSize;
1531 size_t nCurUsedRate;
1532 size_t nMinUsedRate;
1533 size_t nMaxUsedRate;
1536 typedef struct _FX_MEMINFO_
1538 size_t memBlockCount[64];
1539 FX_MEMPAGESTATE pageState8;
1540 FX_MEMPAGESTATE pageState16;
1541 FX_MEMPAGESTATE pageState32;
1542 FX_MEMPAGESTATE pageStateMid;
1543 FX_MEMPAGESTATE pageStateLarge;
1544 FX_MEMPAGESTATE totalState;
1547 #define FX_MEMSTATE_RATEFRACTION 100000 1549 void FX_MemState_MergeInfo(FX_MEMINFO *mi1,
const FX_MEMINFO *mi2);
1550 FX_MEMINFO* FX_MemState_GetInfo();
1551 void FX_MemState_ResetInfo();
1553 #endif //_FX_MEMSTATE_ 1562 #endif //_FX_MEMORY_H_ size_t nPageSize_Mid
Size of memory pages for middle data range (> 32-bytes & <= FX_FIXEDMEM_MIDBLOCKSIZE). 32 for desktop platforms, 8 for limited memory environments.
Definition: fx_memory.h:1493
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.
size_t FXMEM_GetBlockSizeInFixedMgr(FXMEM_FoxitMgr *pFoxitMgr, void *ptr)
Get the size of a memory block to which ptr points.
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:1050
void FXMEM_Free(FXMEM_FoxitMgr *pFoxitMgr, void *pointer, int flags)
Foxit basic memory free function.
void FXMEM_PurgeMgr(FXMEM_FoxitMgr *pFoxitMgr)
Release all excessive memory without touching any used memory. This is useful for extensible fixed me...
#define ASSERT(a)
Assertion for debug mode, do nothing for release mode.
Definition: fx_system.h:794
void * FXMEM_Alloc(FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags)
Foxit basic memory allocation function.
size_t nPageNum_Init8
Initial number of memory pages for 8-bytes fixed data size. 1 for desktop platforms, 1 for limited memory environments.
Definition: fx_memory.h:1471
void * FXMEM_Realloc(FXMEM_FoxitMgr *pFoxitMgr, void *pointer, size_t new_size, int flags)
Foxit basic memory reallocation function.
void FXMEM_DefaultFree(void *pointer, int flags)
Default free function using default Foxit memory manager for current module.
IFX_Allocator * FXMEM_GetDefAllocator()
Get default allocator used by the library.
size_t nPageSize_Large
Minimum size of memory page for large data (> FX_FIXEDMEM_MIDBLOCKSIZE). 128 for desktop platforms...
Definition: fx_memory.h:1499
#define FX_Alloc(type, size)
A macro for Foxit memory allocation operation.
Definition: fx_memory.h:651
Definition: fs_basictypes.h:102
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:1497
FXMEM_FoxitMgr * FXMEM_CreateFoxitMgr(FXMEM_SystemMgr *pSystemMgr)
Create a Foxit manager. A system manager must be provided for actual allocation.
void * user
A generic typeless pointer for user data.
Definition: fx_memory.h:193
void FXMEM_SetDefaultMgr(FXMEM_FoxitMgr *pFoxitMgr)
Set default Foxit manager for current compile module (EXE, DLL, etc.).
Memory debugger interface. All functions must be implemented.
Definition: fx_memory.h:406
void FXMEM_CollectAll(FXMEM_FoxitMgr *pFoxitMgr)
Release all memory blocks allocated by a Foxit manager. This function is only supported on embedded s...
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:125
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:666
void FXMEM_SetConfig(const FX_MEMCONFIG *memConfig)
Set configuration of fixed memory.
void * FXMEM_DefaultRealloc(void *pointer, size_t new_size, int flags)
Default reallocation function using default Foxit memory manager for current module.
char const * FX_LPCSTR
Pointer to constant 8-bit Windows (ANSI) characters.
Definition: fx_system.h:679
FXMEM_FoxitMgr * FXMEM_GetDefaultMgr()
Get default memory manager for current module.
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...
Fixed memory manager.
Definition: fx_memory.h:220
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 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.
size_t nPageNum_Init32
Initial number of memory pages for 32-bytes fixed data size. 24 for desktop platforms, 8 for limited memory environments.
Definition: fx_memory.h:1475
size_t nPageNum_More16
More number of memory pages for 16-bytes fixed data size. 8 for desktop platforms, 4 for limited memory environments.
Definition: fx_memory.h:1480
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...
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:982
Foxit allocator interface.
Definition: fx_memory.h:960
void * FXMEM_DefaultAlloc(size_t byte_size, int flags)
Default allocation function using default Foxit memory manager for current module.
#define FX_Free(pointer)
A macro for Foxit memory free operation.
Definition: fx_memory.h:676
FXMEM_FoxitMgr * FXMEM_CreateFixedMgr(void *pMemory, size_t size, FXMEM_SystemMgr2 *pExtender)
Create a Foxit manager from a pre-allocated, fixed memory buffer.
System level memory manager. Application can implement their own system memory manager.
Definition: fx_memory.h:72
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:1495
void(* FPDF_OOM_Handler)(FXMEM_FoxitMgr *pFoxitMgr, void *param)
the prototype of the Out-Of-Memory handler.
Definition: fx_memory.h:524
size_t nPageNum_Init16
Initial number of memory pages for 16-bytes fixed data size. 8 for desktop platforms, 5 for limited memory environments.
Definition: fx_memory.h:1473
void * FXMEM_AllocDebug(FXMEM_FoxitMgr *pFoxitMgr, size_t size, int flags, FX_LPCSTR file, int line)
Foxit basic memory allocation function in debug-mode.
void FXMEM_ReportOOM(FXMEM_FoxitMgr *pFoxitMgr)
Report Out-of-memory (OOM).
void FXMEM_SetOOMHandler(FXMEM_FoxitMgr *pFoxitMgr, FPDF_OOM_Handler pOOMReportFunc, void *param)
Setup A Out-Of-Memory handler for a Foxit memory manager.
size_t nPageNum_More32
More number of memry pages for 32-bytes fixed data size. 24 for desktop platforms, 12 for limited memory environments.
Definition: fx_memory.h:1482
FXMEM_FoxitMgr * FXMEM_CreateMemoryMgr(size_t size, FX_BOOL extensible)
Create a fixed memory manager as default implementation.
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...
Structure of fixed memory configuration.
Definition: fx_memory.h:1468
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.
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:1501
#define NULL
The null-pointer value.
Definition: fx_system.h:767
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:749
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:137
#define FX_Allocator_Free(fxAllocator, ptr)
Free memory block on an allocator.
Definition: fx_memory.h:1057
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...
unsigned char FX_BYTE
Byte (8 bits).
Definition: fx_system.h:644
Header file for system related definitions.