<<< PK_DELTA Functions | Chapters | Application I/O Functions >>> |
This appendix contains the specifications of the Frustrum functions required for allocating and freeing memory, used when PK functions return variable length information. These functions are called by the PK functions PK_MEMORY_alloc and PK_MEMORY_free.
The functions should be type compatible with malloc and free in the standard C run-time library.
The section on "Memory management functions" in Chapter 1, "PK Interface Programming Concepts", of the Parasolid PK Interface Programming Reference Manual (Part 1 - Functions) provides further information on the use of these functions.
The functions are allowed to longjump out of Parasolid in case of an error, with the same restrictions and requirements as the user registered error handling function (see Chapter 58, "Error Handling", of the Parasolid Functional Description manual).
The memory management functions must be registered with Parasolid by calling the function PK_MEMORY_register_callbacks. This function can be called before starting a Parasolid modeling session, or during a session whenever Parasolid's internal PK memory is empty.
If the functions have not been registered, or either of the function pointers given to PK_MEMORY_register_callbacks is NULL, Parasolid defaults to using the appropriate function from the standard C run-time-library when the application calls PK_MEMORY_alloc or PK_MEMORY_free.
Note: In the following Frustrum function definitions, the function names given are purely nominal, as the functions are registered by the call to PK_MEMORY_register_callbacks. |
void* alloc ( size_t nbytes /* number of bytes required */ ) |
Called by the PK function PK_MEMORY_alloc. The allocator must return NULL in the event of an error.
void free ( void *pointer /* pointer to allocated memory */ ) |
Called by the PK function PK_MEMORY_free to free previously allocated memory.
<<< PK_DELTA Functions | Chapters | Application I/O Functions >>> |