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

  thee | Pointer 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

  name | Pointer 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

  thee | Pointer 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

  thee | Pointer to the Vmem object
  num | number of the allocated address
  size | size of one allocated address
  ram | Pointer 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

  thee | Pointer 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

  thee | Pointer 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

  thee | Pointer to the Vmem object
  num | number of the allocated address
  size | size 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

  thee | Pointer 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

  thee | Pointer 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

  thee | Pointer 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

  thee | Pointer to the Vmem object
  num | number of the allocated address
  size | size of one allocated address
  ram | Pointer to pointer of the reallocated memory
  newNum | number of the reallocated address