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 702 template <
typename T,
typename D = std::default_delete<T>>
703 class CFX_MaybeOwned {
705 CFX_MaybeOwned() : m_pObj(
nullptr) {}
706 explicit CFX_MaybeOwned(T* ptr) : m_pObj(ptr) {}
707 explicit CFX_MaybeOwned(std::unique_ptr<T, D> ptr)
708 : m_pOwnedObj(
std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
710 CFX_MaybeOwned(CFX_MaybeOwned&& that) FX_NOEXCEPT
711 : m_pOwnedObj(that.m_pOwnedObj.release()), m_pObj(that.m_pObj) {
712 that.m_pObj =
nullptr;
715 void Reset(std::unique_ptr<T, D> ptr) {
716 m_pOwnedObj = std::move(ptr);
717 m_pObj = m_pOwnedObj.get();
719 void Reset(T* ptr =
nullptr) {
724 bool IsOwned()
const {
return !!m_pOwnedObj; }
725 T* Get()
const {
return m_pObj; }
726 std::unique_ptr<T, D> Release() {
728 return std::move(m_pOwnedObj);
731 CFX_MaybeOwned& operator=(CFX_MaybeOwned&& that) {
732 m_pOwnedObj = std::move(that.m_pOwnedObj);
733 m_pObj = that.m_pObj;
734 that.m_pObj =
nullptr;
737 CFX_MaybeOwned& operator=(T* ptr) {
741 CFX_MaybeOwned& operator=(std::unique_ptr<T, D> ptr) {
742 Reset(std::move(ptr));
746 bool operator==(
const CFX_MaybeOwned& that)
const {
747 return Get() == that.Get();
749 bool operator==(
const std::unique_ptr<T, D>& ptr)
const {
750 return Get() == ptr.get();
752 bool operator==(T* ptr)
const {
return Get() == ptr; }
754 bool operator!=(
const CFX_MaybeOwned& that)
const {
return !(*
this == that); }
755 bool operator!=(
const std::unique_ptr<T, D> ptr)
const {
756 return !(*
this == ptr);
758 bool operator!=(T* ptr)
const {
return !(*
this == ptr); }
760 FX_EXPLICIT_OPERATOR
operator bool()
const {
return !!m_pObj; }
761 T& operator*()
const {
return *m_pObj; }
762 T* operator->()
const {
return m_pObj; }
764 CFX_MaybeOwned(
const CFX_MaybeOwned& that) FX_EQDELETE;
765 CFX_MaybeOwned& operator=(
const CFX_MaybeOwned& that) FX_EQDELETE;
768 std::unique_ptr<T, D> m_pOwnedObj;
773 struct CFX_FreeDeleter {
774 inline void operator()(
void* ptr)
const {
FX_Free(ptr); }
795 void*
operator new (
size_t size,
FX_LPCSTR file,
int line);
796 #ifndef _FX_NO_EXCEPTION_ 806 void operator delete (
void* p,
FX_LPCSTR file,
int line);
816 void*
operator new (
size_t size);
824 void operator delete (
void* p);
835 void*
operator new[] (
size_t size,
FX_LPCSTR file,
int line);
836 #ifndef _FX_NO_EXCEPTION_ 846 void operator delete[] (
void* p,
FX_LPCSTR file,
int line);
856 void*
operator new[] (
size_t size);
864 void operator delete[] (
void* p);
869 void*
operator new (size_t,
void* buf) {
return buf; }
870 #ifndef _FX_NO_EXCEPTION_ 874 void operator delete (
void*,
void*) {}
885 #if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || _FX_OS_ == _FX_WIN64_) && !defined(__PLACEMENT_NEW_INLINE) && !defined(_MFC_VER) && !defined(_NEW) 886 #define __PLACEMENT_NEW_INLINE 888 inline void*
operator new(
size_t size,
void* pos)
893 inline void operator delete(
void* ptr,
void* pos)
896 #endif //__PLACEMENT_NEW_INLINE 906 #define FX_NEW new(__FILE__, __LINE__) 916 #ifndef _FPDFAPI_MINI_ 919 #define FX_NEW_VECTOR(Pointer, Class, Count) Pointer = FX_NEW Class[Count] 921 #define FX_DELETE_VECTOR(Pointer, Class, Count) delete[] Pointer 925 #define FX_NEW_VECTOR(Pointer, Class, Count) \ 927 Pointer = FX_Alloc(Class, Count); \ 929 for (int i = 0; i < (Count); i ++) new (Pointer + i) Class; \ 932 #define FX_DELETE_VECTOR(Pointer, Class, Count) \ 934 for (int i = 0; i < (Count); i ++) Pointer[i].~Class(); \ 945 class CFX_DestructObject :
public CFX_Object
949 virtual ~CFX_DestructObject() {}
961 typedef struct _IFX_Allocator
976 void* (*m_AllocDebug)(
struct _IFX_Allocator* pAllocator,
size_t size,
FX_LPCSTR file,
int line);
988 void* (*m_Alloc)(
struct _IFX_Allocator* pAllocator,
size_t size);
1003 void* (*m_ReallocDebug)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size,
FX_LPCSTR file,
int line);
1016 void* (*m_Realloc)(
struct _IFX_Allocator* pAllocator,
void* p,
size_t size);
1028 void (*m_Free)(
struct _IFX_Allocator* pAllocator,
void* p);
1044 #define FX_Allocator_Alloc(fxAllocator, type, size) \ 1045 ((fxAllocator) ? (type*)(fxAllocator)->m_AllocDebug((fxAllocator), (size) * sizeof(type), __FILE__, __LINE__) : (FX_Alloc(type, size))) 1047 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \ 1048 ((fxAllocator) ? (type*)(fxAllocator)->m_ReallocDebug((fxAllocator), (ptr), (new_size) * sizeof(type), __FILE__, __LINE__) : (FX_Realloc(type, ptr, new_size))) 1051 #define FX_Allocator_Alloc(fxAllocator, type, size) \ 1052 ((fxAllocator) ? (type*)(fxAllocator)->m_Alloc((fxAllocator), (size) * sizeof(type)) : (FX_Alloc(type, size))) 1054 #define FX_Allocator_Realloc(fxAllocator, type, ptr, new_size) \ 1055 ((fxAllocator) ? (type*)(fxAllocator)->m_Realloc((fxAllocator), (ptr), (new_size) * sizeof(type)) : (FX_Realloc(type, ptr, new_size))) 1058 #define FX_Allocator_Free(fxAllocator, ptr) \ 1059 ((fxAllocator) ? (fxAllocator)->m_Free((fxAllocator), (ptr)) : (FX_Free(ptr))) 1065 inline void*
operator new(
size_t size,
IFX_Allocator* fxAllocator)
1070 inline void operator delete(
void* ptr,
IFX_Allocator* fxAllocator)
1076 #define FX_NewAtAllocator(fxAllocator) \ 1077 ::new(static_cast<IFX_Allocator*>(fxAllocator)) 1079 #define FX_DeleteAtAllocator(pointer, fxAllocator, __class__) \ 1080 do { if (!(pointer)) break; (pointer)->~__class__(); ::operator delete(static_cast<void*>(pointer), static_cast<IFX_Allocator*>(fxAllocator)); } while(false) 1087 class CFX_AllocObject
1101 #ifndef _FX_NO_EXCEPTION_ 1123 void*
operator new (
size_t size,
IFX_Allocator* pAllocator);
1131 void operator delete (
void* p);
1132 #ifndef _FX_NO_EXCEPTION_ 1147 void*
operator new (size_t,
void* buf) {
return buf; }
1148 #ifndef _FX_NO_EXCEPTION_ 1152 void operator delete (
void*,
void*) {}
1160 IFX_Allocator* GetAllocator()
const {
return m_pAllocator; }
1173 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator,
FX_LPCSTR file,
int line) {
return operator new(size, pAllocator, file, line); }
1174 #ifndef _FX_NO_EXCEPTION_ 1196 void*
operator new[] (
size_t size,
IFX_Allocator* pAllocator) {
return operator new(size, pAllocator); }
1204 void operator delete[] (
void* p) {}
1205 #ifndef _FX_NO_EXCEPTION_ 1214 void operator delete[] (
void* p,
IFX_Allocator* pAllocator) {}
1225 #define FX_NEWAT(pAllocator) new(pAllocator, __FILE__, __LINE__) 1231 #define FX_NEWAT(pAllocator) new(pAllocator) 1238 #if !defined(_FPDFAPI_MT_NONE_) && !defined(_FPDFAPI_MT_) 1240 #define _FPDFAPI_MT_ 1247 class CFX_LockObject :
public CFX_Object
1251 CFX_LockObject() {FX_InitializeCriticalSection(&m_Lock);}
1253 ~CFX_LockObject() {FX_DeleteCriticalSection(&m_Lock);}
1256 FX_BOOL TryLock() {
return FX_TryEnterCriticalSection(&m_Lock);}
1258 void Lock() {FX_EnterCriticalSection(&m_Lock);}
1260 void Unlock() {FX_LeaveCriticalSection(&m_Lock);}
1264 FX_CRITICAL_SECTION m_Lock;
1265 friend class CFX_CSLock;
1275 CFX_CSLock() : m_pCS(
NULL) {}
1277 CFX_CSLock(FX_CRITICAL_SECTION* pCS) : m_pCS(pCS) {
if (m_pCS) FX_EnterCriticalSection(m_pCS);}
1279 CFX_CSLock(CFX_LockObject* pObj) {m_pCS = &pObj->m_Lock; FX_EnterCriticalSection(m_pCS);}
1281 ~CFX_CSLock() {
if (m_pCS) FX_LeaveCriticalSection(m_pCS);}
1284 FX_CRITICAL_SECTION* m_pCS;
1288 #define FXMT_CSLOCK_THIS CFX_CSLock _fx_lock((CFX_LockObject*)this) 1290 #define FXMT_CSLOCK_OBJ(lock) CFX_CSLock _fx_lock((CFX_LockObject*)lock) 1292 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock) CFX_CSLock csLock((CFX_LockObject*)lock) 1295 #define FXMT_LOCKOBJECT_DEFINE(lockObj) CFX_LockObject lockObj 1297 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj) (lockObj)->TryLock() 1299 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if ((lockObj)->TryLock()) 1301 #define FXMT_LOCKOBJECT_LOCK(lockObj) (lockObj)->Lock() 1303 #define FXMT_LOCKOBJECT_UNLOCK(lockObj) (lockObj)->Unlock() 1305 class CFX_LockObject : public CFX_Object {}; 1306 #define FXMT_CSLOCK_THIS 1307 #define FXMT_CSLOCK_OBJ(lock) 1308 #define FXMT_CSLOCK_DEFINEOBJ(csLock, lock) 1310 #define FXMT_LOCKOBJECT_DEFINE(lockObj) 1311 #define FXMT_LOCKOBJECT_TRYLOCK(lockObj) 1312 #define FXMT_LOCKOBJECT_TRYLOCK_IF(lockObj) if (1) 1313 #define FXMT_LOCKOBJECT_LOCK(lockObj) 1314 #define FXMT_LOCKOBJECT_UNLOCK(lockObj) 1325 class CFX_GrowOnlyPool :
public IFX_Allocator,
public CFX_Object
1342 ~CFX_GrowOnlyPool();
1360 void SetTrunkSize(
size_t trunk_size) { m_TrunkSize = trunk_size; }
1371 void* AllocDebug(
size_t size,
FX_LPCSTR file,
int line) {
return Alloc(size); }
1379 void* Alloc(
size_t size);
1387 void* ReallocDebug(
void* p,
size_t new_size,
FX_LPCSTR file,
int line) {
return NULL; }
1395 void* Realloc(
void* p,
size_t new_size) {
return NULL; }
1401 void Free(
void* mem) {}
1414 void* m_pFirstTrunk;
1419 FX_CRITICAL_SECTION m_Lock;
1425 template <
class T>
class AllocProxy :
public CFX_Object {
1427 AllocProxy(
size_t size) { buffer = (T *)
FX_Alloc(T, size); }
1428 ~AllocProxy() {
if (buffer)
FX_Free(buffer); }
1429 T &operator[](
int index) {
return buffer[index]; }
1430 operator T *() {
return buffer; }
1431 T *
operator +(
int offset) {
return buffer + offset; }
1432 operator bool()
const {
return !!buffer; }
1433 T *operator->()
const {
return buffer; }
1436 AllocProxy(
const AllocProxy &) {}
1437 AllocProxy &operator=(
const AllocProxy &) {}
1443 struct CFX_ReleaseDeleter {
1444 inline void operator()(T* ptr)
const { ptr->Release(); }
1450 #endif //__cplusplus 1460 #define _FXMEM_NO64_ 1464 #define FX_FIXEDMEM_PAGESIZE (4096 * 16) 1466 #define FX_FIXEDMEM_MIDBLOCKSIZE (4096) 1469 typedef struct _FX_MEMCONFIG
1477 #if !defined(_FXMEM_NO64_) 1478 size_t nPageNum_Init64;
1484 #if !defined(_FXMEM_NO64_) 1485 size_t nPageNum_More64;
1487 #if defined(_FXMEM_LIT_) 1488 size_t nPageSize_Lit;
1489 size_t nPageNum_InitLit;
1490 size_t nPageNum_MoreLit;
1491 size_t nPageNum_ReservedLit;
1519 #if defined(_FX_MEMSTATE_) 1521 typedef struct _FX_MEMPAGESTATE_
1526 size_t nCurAvailSize;
1527 size_t nMinAvailSize;
1528 size_t nMaxAvailSize;
1529 size_t nCurUsedSize;
1530 size_t nMinUsedSize;
1531 size_t nMaxUsedSize;
1532 size_t nCurUsedRate;
1533 size_t nMinUsedRate;
1534 size_t nMaxUsedRate;
1537 typedef struct _FX_MEMINFO_
1539 size_t memBlockCount[64];
1540 FX_MEMPAGESTATE pageState8;
1541 FX_MEMPAGESTATE pageState16;
1542 FX_MEMPAGESTATE pageState32;
1543 FX_MEMPAGESTATE pageStateMid;
1544 FX_MEMPAGESTATE pageStateLarge;
1545 FX_MEMPAGESTATE totalState;
1548 #define FX_MEMSTATE_RATEFRACTION 100000 1550 void FX_MemState_MergeInfo(FX_MEMINFO *mi1,
const FX_MEMINFO *mi2);
1551 FX_MEMINFO* FX_MemState_GetInfo();
1552 void FX_MemState_ResetInfo();
1554 #endif //_FX_MEMSTATE_ 1563 #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:1494
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:1051
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:800
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:1472
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:1500
#define FX_Alloc(type, size)
A macro for Foxit memory allocation operation.
Definition: fx_memory.h:651
Definition: fs_basictypes.h:105
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:1498
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:128
int FX_BOOL
Boolean variable (should be TRUE or FALSE).
Definition: fx_system.h:670
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:684
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:1476
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:1481
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:989
Foxit allocator interface.
Definition: fx_memory.h:961
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:1496
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:1474
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:1483
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:1469
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:1502
#define NULL
The null-pointer value.
Definition: fx_system.h:773
#define FX_DEFINEHANDLE(name)
Macro to define a handle type.
Definition: fx_system.h:753
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:140
#define FX_Allocator_Free(fxAllocator, ptr)
Free memory block on an allocator.
Definition: fx_memory.h:1058
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.