This function has been deprecated and will be removed from the public API in a future release. No alternative is available in the ImageGear for C and C++ API. Applications that require greater control over memory allocations must substitute C runtime functions malloc, realloc, and free with their own implementations.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_mem_CB_register( LPFNIG_MEM_ALLOC lpfnAllocFunc, LPFNIG_MEM_REALLOC lpfnReAllocFunc, LPFNIG_MEM_FREE lpfnFreeFunc ); |
Name | Type | Description |
---|---|---|
lpfnAllocFunc | LPFNIG_MEM_ALLOC | Far pointer to your function to be called for memory allocations. |
lpfnReAllocFunc | LPFNIG_MEM_REALLOC | Far pointer to your function to be called for memory reallocations. |
lpfnFreeFunc | LPFNIG_MEM_FREE | Far pointer to your function to be called to free memory free. |
Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.
This function does not process image pixels.
Copy Code
|
|
---|---|
/* Memory Alloc callback function definition */ LPBYTE ACCUAPI MyMemAlloc(DWORD dwSize)/* number of bytes to alloc */ { /* Put your own memory allocation code here */ return( buffer); }; /* Memory ReAlloc callback function definition */ LPBYTE ACCUAPI MyMemReAlloc( LPBYTE lpBuffer, DWORD dwSize) { /* Put your own memory reallocation code here */ return( lpBuffer); }; /* Memory Free callback function definition */ LPBYTE ACCUAPI MyMemFree(LPBYTE lpBuffer) { /*Put your free-the-memory code here */ return NULL; }; /* Registration Example */ /* Example one */ /* Register your own callback functions for all memory routines */ nErrcount = IG_mem_CB_register(MyMemAlloc, MyMemReAlloc, MyMemFree); /* Example two */ /* Supply callbacks for memory alloc only */ nErrcount = IG_mem_CB_register(MyMemAlloc, NULL, NULL); |
This function registers your own callback functions to be called to do large memory allocations, memory reallocations, and memory freeing.
As shown in the prototype, your memory callback functions must be of types LPFNIG_MEM_ALLOC, LPFNIG_MEM_REALLOC and LPFNIG_MEM_FREE.
Set any of the three arguments to NULL if you want ImageGear to use its own definition for these functions.