_tfree -- Free Tiled Storage Block (OS/2)

Format

#include <stdlib.h>  /* also in <malloc.h> */
void _tfree(void *ptr);

Language Level: Extension
_tfree frees the tiled memory pointed to by ptr that has been allocated by one of the memory management functions. If ptr is NULL, then no action occurs.

_tfree works just like free except that it frees tiled memory instead of regular memory. The _tfree function can only be used to free memory allocated by the tiled memory management functions (_tcalloc and so on).

To use _tfree, you must compile with the /Gt compiler option. This option maps all free calls to _tfree.

Note: The /Gt option maps all calls to regular memory management functions to their tiled versions. To prevent a call from being mapped, parenthesize the function name.

A debug version of this function, _debug_tfree is also available. Use the /Tm option to map _tfree calls to _debug_tfree.

Return Value
There is no return value.

Example
This example uses _tfree to free a block of tiled memory previously allocated by _tmalloc.

Note: You must compile this example with the /Gt option to enable tiled memory.

#include <stdlib.h>
#include <stdio.h>
int main(void)
{
   char *memoryPtr;
   if (NULL != (memoryPtr = (char*)malloc(100)))
      puts("Successfully allocated 100 bytes of tiled memory.");
   else
      puts("Could not allocate tiled memory.");
   free(memoryPtr);
   return 0;
   /**********************************************************
      The output should be similar to :
      Successfully allocated 100 bytes of tiled memory.
   **********************************************************/
}


Memory Management


free -- Release Storage Blocks
_debug_free -- Release Memory
_debug_tfree -- Release Tiled Memory
_tcalloc -- Reserve Tiled Storage Block
_theapmin -- Release Unused Tiled Memory
_tmalloc -- Reserve Tiled Storage Block
_trealloc -- Reallocate Tiled Storage Block
<malloc.h>
<stdlib.h>
/Tm compiler option
/Gt compiler option