BOOL stMemoryFree( PVOID MemoryPool, PVOID Ptr );
Address of the memory pool.
Address of the memory block to be released.
TRUE on success or FALSE on failure. Use the stGetLastError function to obtain extended error information.
This function releases a memory block previously allocated by the stMemoryAlloc function.
When the ST_USE_SAFE_MEMORY_FREE constant is set to 1, passing an invalid address to
stMemoryFree is handled safely; the function returns FALSE, and the last error code is set to ERR_INVALID_MEMORY_BLOCK.
However, using this safe memory release method increases the time required for memory allocation and deallocation. To improve performance, ST_USE_SAFE_MEMORY_FREE can be set to 0 to disable address validation. When validation is disabled, passing an invalid address to stMemoryFree will result in unpredictable behavior and may cause the system to hang.
This function will be excluded from compilation if memory management functions are disabled by setting ST_USE_MEMORY to 0.
| Version: | 1.0 |
|---|---|
| Header file: | ST_Memory.h (include ST_API.h) |
| See also: | BOOL, dynamic memory allocation example, FALSE, memory management, memory pool initialization example, PVOID, ST_USE_MEMORY, stGetLastError, stMemoryAlloc, TRUE |