MALOC  0.1
Files | Classes | Typedefs | Functions
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. More...
 

Functions

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

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

◆ 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)

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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)

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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