FSCRT_MEMMGRHANDLER Struct Reference

Structure for memory management. More...

#include <fs_base_r.h>

Public Attributes

FS_LPVOID clientData
 User-defined data. More...
 
FS_LPVOID(* Alloc )(FS_LPVOID clientData, FS_DWORD size)
 A callback function to allocate a memory block. More...
 
FS_LPVOID(* Realloc )(FS_LPVOID clientData, FS_LPVOID ptr, FS_DWORD newSize)
 A callback function to reallocate a memory block. More...
 
void(* Free )(FS_LPVOID clientData, FS_LPVOID ptr)
 A callback function to free a memory block. More...
 

Detailed Description

Structure for memory management.

Note
This is a handler and should be implemented by applications.
Memory manager provides platform-based memory allocation and free controls.
Function FSCRT_Library_CreateMgr uses a memory manager to initialize Foxit PDF SDK manager.

Member Data Documentation

FS_LPVOID(* FSCRT_MEMMGRHANDLER::Alloc) (FS_LPVOID clientData, FS_DWORD size)

A callback function to allocate a memory block.

Parameters
[in]clientDataPointer to user-defined data.
[in]sizeThe number of bytes for memory block. It can be 0.
Returns
The pointer to allocated memory block. NULL if fails.
Note
Applications should avoid any exceptions when this function is called, and should also ensure it supports multiple-thread environments.
If the parameter size is 0, a minimum size of memory block should be returned.
Function FSCRT_Memory_Alloc calls this function.
FS_LPVOID FSCRT_MEMMGRHANDLER::clientData

User-defined data.

Note
Applications can use this field to track controls.
void(* FSCRT_MEMMGRHANDLER::Free) (FS_LPVOID clientData, FS_LPVOID ptr)

A callback function to free a memory block.

Parameters
[in]clientDataPointer to user-defined data.
[in]ptrPointer to an existing memory block to be freed.
Returns
None.
Note
Applications should avoid any exceptions when this function is called, and should also ensure it supports multiple-thread environments.
Function FSCRT_Memory_Free calls this function.
FS_LPVOID(* FSCRT_MEMMGRHANDLER::Realloc) (FS_LPVOID clientData, FS_LPVOID ptr, FS_DWORD newSize)

A callback function to reallocate a memory block.

Parameters
[in]clientDataPointer to user-defined data.
[in]ptrPointer to an existing memory block, or NULL.
[in]newSizeNew size of a memory block, in bytes. It can be 0.
Returns
The pointer of reallocated memory block, or NULL if fails.
Note
Applications should avoid any exceptions when this function is called, and should also ensure it supports multiple-thread environments.
If the parameter ptr is NULL, this function has the same action as function FSCRT_MEMMGRHANDLER::Alloc.
If the parameter newSize is 0, this function returns a pointer of parameter ptr directly.
Function FSCRT_Memory_Realloc calls this function.

The documentation for this struct was generated from the following file:

Foxit Corporation