MALOC 0.1
Vmem class

This class provides a safe logged version of malloc and free. More...

Files

file  vmem.h
 Class Vmem: A safer, object-oriented, malloc/free object.

Classes

struct  sVmem
 Contains public data members for Vmem class. More...

Typedefs

typedef struct sVmem Vmem
 Declaration of the Vmem class as the Vmem structure.

Functions

size_t Vmem_bytesTotal (void)
 Return total of all active Vmem malloc areas (current footprint).
size_t Vmem_mallocBytesTotal (void)
 Return total of all Vmem malloc allocations.
size_t Vmem_freeBytesTotal (void)
 Return total of all Vmem free calls.
size_t Vmem_highWaterTotal (void)
 Return the high-water byte mark (largest footprint).
size_t Vmem_mallocAreasTotal (void)
 Return total of all active Vmem malloc areas by groups.
void Vmem_printTotal (void)
 Print current memory statistics for all Vmem malloc/free areas.
Vmem * Vmem_ctor (char *name)
 Construct the dynamic memory allocation logging object.
void Vmem_dtor (Vmem **thee)
 Destruct the dynamic memory allocation logging object.
void * Vmem_malloc (Vmem *thee, size_t num, size_t size)
 A safe logged version of malloc.
void Vmem_free (Vmem *thee, size_t num, size_t size, void **ram)
 A safe logged version of free.
void * Vmem_realloc (Vmem *thee, size_t num, size_t size, void **ram, size_t newNum)
 A safe logged version of realloc (usually a bad idea to use this).
size_t Vmem_bytes (Vmem *thee)
 Return total of all ACTIVE malloc areas used by Vmem object.
size_t Vmem_mallocBytes (Vmem *thee)
 Return total of all mallocs performed by Vmem object.
size_t Vmem_freeBytes (Vmem *thee)
 Return total of all frees performed by Vmem object.
size_t Vmem_highWater (Vmem *thee)
 Return high-water malloc bytemark hit by Vmem object.
size_t Vmem_mallocAreas (Vmem *thee)
 Return total number of individual active malloc areas.
void Vmem_print (Vmem *thee)
 Print current memory stats associated with this Vmem object.

Detailed Description

This class provides a safe logged version of malloc and free.

This class provides a safe logged version of malloc and free, with all standard routines supported with Vmem variants.

Typedef Documentation

◆ Vmem

typedef struct sVmem Vmem

Declaration of the Vmem class as the Vmem structure.

Author
Michael Holst

Function Documentation

◆ Vmem_bytes()

size_t Vmem_bytes ( Vmem * thee)

Return total of all ACTIVE malloc areas used by Vmem object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all ACTIVE malloc areas used by Vmem object
Parameters
theePointer to the Vmem object

References Vmem_bytes().

Referenced by Vmem_bytes().

Here is the call graph for this function:

◆ Vmem_bytesTotal()

size_t Vmem_bytesTotal ( void )

Return total of all active Vmem malloc areas (current footprint).

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all active Vmem malloc areas (current footprint)

References Vmem_bytesTotal().

Referenced by Vmem_bytesTotal().

Here is the call graph for this function:

◆ Vmem_ctor()

Vmem * Vmem_ctor ( char * name)

Construct the dynamic memory allocation logging object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
Pointer to a newly created Vmem object
Parameters
namePointer to the object name

References Vmem_ctor().

Referenced by Vmem_ctor().

Here is the call graph for this function:

◆ Vmem_dtor()

void Vmem_dtor ( Vmem ** thee)

Destruct the dynamic memory allocation logging object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
None
Parameters
theePointer to the Vmem object

References Vmem_dtor().

Referenced by Vmem_dtor().

Here is the call graph for this function:

◆ Vmem_free()

void Vmem_free ( Vmem * thee,
size_t num,
size_t size,
void ** ram )

A safe logged version of free.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
None
Parameters
theePointer to the Vmem object
numnumber of the allocated address
sizesize of one allocated address
ramPointer to pointer of the reallocated memory

References Vmem_free().

Referenced by Vmem_free().

Here is the call graph for this function:

◆ Vmem_freeBytes()

size_t Vmem_freeBytes ( Vmem * thee)

Return total of all frees performed by Vmem object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all frees performed by Vmem object
Parameters
theePointer to the Vmem object

References Vmem_freeBytes().

Referenced by Vmem_freeBytes().

Here is the call graph for this function:

◆ Vmem_freeBytesTotal()

size_t Vmem_freeBytesTotal ( void )

Return total of all Vmem free calls.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all Vmem free calls

References Vmem_freeBytesTotal().

Referenced by Vmem_freeBytesTotal().

Here is the call graph for this function:

◆ Vmem_highWater()

size_t Vmem_highWater ( Vmem * thee)

Return high-water malloc bytemark hit by Vmem object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
high-water malloc bytemark hit by Vmem object
Parameters
theePointer to the Vmem object

References Vmem_highWater().

Referenced by Vmem_highWater().

Here is the call graph for this function:

◆ Vmem_highWaterTotal()

size_t Vmem_highWaterTotal ( void )

Return the high-water byte mark (largest footprint).

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
the high-water byte mark (largest footprint)

References Vmem_highWaterTotal().

Referenced by Vmem_highWaterTotal().

Here is the call graph for this function:

◆ Vmem_malloc()

void * Vmem_malloc ( Vmem * thee,
size_t num,
size_t size )

A safe logged version of malloc.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
Void pointer to a new malloc area
Parameters
theePointer to the Vmem object
numnumber of the allocated address
sizesize of one allocated address

References Vmem_malloc().

Referenced by Vmem_malloc().

Here is the call graph for this function:

◆ Vmem_mallocAreas()

size_t Vmem_mallocAreas ( Vmem * thee)

Return total number of individual active malloc areas.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total number of individual active malloc areas
Parameters
theePointer to the Vmem object

References Vmem_mallocAreas().

Referenced by Vmem_mallocAreas().

Here is the call graph for this function:

◆ Vmem_mallocAreasTotal()

size_t Vmem_mallocAreasTotal ( void )

Return total of all active Vmem malloc areas by groups.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all active Vmem malloc areas by groups

References Vmem_mallocAreasTotal().

Referenced by Vmem_mallocAreasTotal().

Here is the call graph for this function:

◆ Vmem_mallocBytes()

size_t Vmem_mallocBytes ( Vmem * thee)

Return total of all mallocs performed by Vmem object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all mallocs performed by Vmem object
Parameters
theePointer to the Vmem object

References Vmem_mallocBytes().

Referenced by Vmem_mallocBytes().

Here is the call graph for this function:

◆ Vmem_mallocBytesTotal()

size_t Vmem_mallocBytesTotal ( void )

Return total of all Vmem malloc allocations.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
total of all Vmem malloc allocations

References Vmem_mallocBytesTotal().

Referenced by Vmem_mallocBytesTotal().

Here is the call graph for this function:

◆ Vmem_print()

void Vmem_print ( Vmem * thee)

Print current memory stats associated with this Vmem object.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
None
Parameters
theePointer to the Vmem object

References Vmem_print().

Referenced by Vmem_print().

Here is the call graph for this function:

◆ Vmem_printTotal()

void Vmem_printTotal ( void )

Print current memory statistics for all Vmem malloc/free areas.

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
None

References Vmem_printTotal().

Referenced by Vmem_printTotal().

Here is the call graph for this function:

◆ Vmem_realloc()

void * Vmem_realloc ( Vmem * thee,
size_t num,
size_t size,
void ** ram,
size_t newNum )

A safe logged version of realloc (usually a bad idea to use this).

Author
Michael Holst
Note
Class Vmem: Non-Inlineable methods (vmem.c)
Returns
Void pointer to a new malloc area
Parameters
theePointer to the Vmem object
numnumber of the allocated address
sizesize of one allocated address
ramPointer to pointer of the reallocated memory
newNumnumber of the reallocated address

References Vmem_realloc().

Referenced by Vmem_realloc().

Here is the call graph for this function: