Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

Classes | Functions
Finding (Information About) Memory Allocations
Collaboration diagram for Finding (Information About) Memory Allocations:

Classes

class  libcwd::alloc_ct
 An object of type alloc_ct contains information about one allocated memory block. More...
 

Functions

alloc_ct const * libcwd::find_alloc (void const *ptr)
 Find information about a memory allocation. More...
 

Detailed Description

Function Documentation

◆ find_alloc()

alloc_ct const* libcwd::find_alloc ( void const *  ptr)

Find information about a memory allocation.

Given a pointer, which points to the start of or inside an allocated memory block, it is possible to find information about this memory block using the libcwd function find_alloc.

Returns
a const pointer to an object of class alloc_ct.
See also
test_delete()

Example:

char* buf = new char [40];
AllocTag(buf, "A buffer");
libcwd::alloc_ct const* alloc = libcwd::find_alloc(&buf[10]);
std::cout << '"' << alloc->description() << "\" is " << alloc->size() << " bytes.\n";
An object of type alloc_ct contains information about one allocated memory block.
Definition: class_alloc.h:60
size_t size() const
The allocated size in bytes.
Definition: class_alloc.h:76
char const * description() const
A pointer to a description of the allocated memory block.
Definition: class_alloc.h:102
alloc_ct const * find_alloc(void const *ptr)
Find information about a memory allocation.
Definition: debugmalloc.cc:3641

gives as output,

"A buffer" is 40 bytes.

Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.