Format
#include <stdlib.h> /* also in <malloc.h> */ void _tdump_allocated_delta(int nbytes);
Language Level: Extension
For the heap you specify, _tdump_allocated_delta
prints information to stderr about each tiled memory block
allocated by a tiled debug memory management function
(_debug_tmalloc and so on) since the last call to
_tdump_allocated_delta or _tdump_allocated.
_tdump_allocated_delta and _tdump_allocated print the same type of information to stderr, but _tdump_allocated displays information about all blocks that have been allocated since the start of your program.
_tdump_allocated_delta works just like _dump_allocated_delta, except that it displays information about tiled memory instead of regular memory.
Use nbytes to specify how many bytes of each memory block are to be printed. If nbytes is:
| Negative value | Prints all bytes of each block. |
| 0 | Prints no bytes. |
| Positive value | Prints the specified number of bytes or the entire block, whichever is smaller. |
_tdump_allocated_delta prints the information to stderr by default. You can change the destination with the _set_crt_msg_handle function.
To use _tdump_allocated_delta and the tiled debug versions of the memory management functions, specify the debug memory (/Tm) and tiled memory (/Gt) compiler options.
Note: The /Tm /Gt options map all calls to regular memory management functions to their tiled debug versions. To prevent a call from being mapped, parenthesize the function name.
Return Value
There is no return value.
Example
This example allocates some memory and calls
_tdump_allocated to print information about the allocated blocks.
It then allocates more memory, and calls _tdump_allocated_delta
to print information about the blocks allocated since the call to
_tdump_allocated.
Note: You must compile this example with the /Tm /Gt options.
#include <stdlib.h> #include <stdio.h> #include <string.h>
int main(void)
{
char *ptr1, *ptr2;
if (NULL == (ptr1 = (char*)malloc(10))) {
puts("Could not allocate memory block.");
exit(EXIT_FAILURE);
}
memset(ptr1, 'a', 5);
_tdump_allocated(10);
if (NULL == (ptr2 = (char*)malloc(20))) {
puts("Could not allocate memory block.");
exit(EXIT_FAILURE);
}
memset(ptr2, 'b', 5);
_tdump_allocated_delta(10);
free(ptr1); free(ptr2); return 0;
/****************************************************************************
The output should be similar to :
--------------------------------------------------------------------------
START OF DUMP OF ALLOCATED MEMORY BLOCKS
--------------------------------------------------------------------------
Address: 0x00080120 Size: 0x0000000A (10)
This memory block was (re)allocated at line number 8 in _tdump_all_d.c.
Memory contents: 61616161 61AAAAAA AAAA [aaaaaªªªªª ]
--------------------------------------------------------------------------
END OF DUMP OF ALLOCATED MEMORY BLOCKS
--------------------------------------------------------------------------
--------------------------------------------------------------------------
START OF DUMP OF ALLOCATED MEMORY BLOCKS
--------------------------------------------------------------------------
Address: 0x00080160 Size: 0x00000014 (20)
This memory block was (re)allocated at line number 15 in _tdump_all_d.c.
Memory contents: 62626262 62AAAAAA AAAA [bbbbbªªªªª ]
--------------------------------------------------------------------------
END OF DUMP OF ALLOCATED MEMORY BLOCKS
--------------------------------------------------------------------------
****************************************************************************/
}
![]()
Managing Memory
with Multiple Heaps
Memory Management
![]()
_debug_tcalloc -- Reserve and Initialize
Tiled Memory
_debug_tfree -- Release Tiled Memory
_debug_theapmin -- Release Unused Memory
_debug_tmalloc -- Reserve Tiled Memory
_debug_trealloc -- Reallocate Tiled Memory
_dump_allocated -- Get Information about
Allocated Memory
_set_crt_msg_handle -- Change Runtime
Message Output Destionation
_tdump_allocated -- Get Information about
Allocated Tiled Memory
_udump_allocated -- Get Information about
Allocated Memory in Heap
<malloc.h>
<stdlib.h>
/Tm compiler option
/Gt compiler option