### _tcalloc -- Reserve Tiled Storage Block (OS/2)

Format

>     #include <stdlib.h>  /* also in <malloc.h> */
>     void *_tcalloc(size_t number, size_t size)

Language Level: Extension
_tcalloc allocates tiled memory for an array of number elements, each of length size bytes, and initializes all bits of each element to 0.

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

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.

_tcalloc works just like calloc except that it allocates tiled memory instead of regular memory. Tiled memory will not cross 64K boundaries, as long as the object is less than 64K in size. Objects larger than 64K in size will cross 64K boundaries. If you have objects that may be accessed by 16-bit code, you should store them in tiled memory. Tiled memory is limited to 512 MB per process.

A debug version of this function, _debug_tcalloc, is also available. Use the /Tm compiler option to map _tcalloc calls to _debug_tcalloc.

Return Value
_tcalloc returns a pointer to the allocated tiled memory. If not enough storage is available, or if num or size is 0, _tcalloc returns NULL.

Example
This example allocates tiled memory for an array of 100 elements of size char.

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*)calloc(100, sizeof(char))))
          puts("Successfully allocated 100 char of tiled memory.");
       else
          puts("Could not allocate tiled memory.");
       free(memoryPtr);
       return 0;

       /**********************************************************
          The output should be similar to :

          Successfully allocated 100 char of tiled memory.
       **********************************************************/
    }

Memory Management

calloc -- Reserve and Initiate Storage
_debug_calloc -- Allocate and Initialize Memory
_debug_tcalloc -- Reserve and Initialize Tiled Memory
_tdump_allocated -- Get Information about Allocated Tiled Memory
_tdump_allocated_delta -- Get Information about Allocated Tiled Memory
_tfree -- Free Tiled Storage Block
_theapmin -- Release Unused Tiled Memory
_tmalloc -- Reserve Tiled Storage Block
_trealloc -- Reallocate Tiled Storage Block
_ucalloc -- Reserve and Initialize Memory from User Heap
<malloc.h>
<stdlib.h>
/Gt compiler option
/Tm compiler option