libmsr  0.3.0
A friendlier interface to accessing MSRs on Intel platforms
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Enumerations | Functions
memhdlr.h File Reference
#include <stdlib.h>
Include dependency graph for memhdlr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  libmsr_mem_mgmt_e {
  LIBMSR_FREE,
  LIBMSR_MALLOC,
  LIBMSR_CALLOC,
  LIBMSR_REALLOC,
  LIBMSR_FINALIZE
}
 Enum encompassing types of libmsr memory management. More...
 

Functions

void * libmsr_malloc (size_t size)
 Allocate size bytes with malloc().
 
void * libmsr_calloc (size_t num, size_t size)
 Allocate memory for an array of num elements of size bytes each with calloc().
 
void * libmsr_realloc (void *addr, size_t size)
 Change allocation of existing memory to size bytes with realloc().
 
void * libmsr_free (void *addr)
 Free single dynamic memory allocation.
 
void * memhdlr_finalize (void)
 Deallocate any remaining memory allocations and deallocate tracking structure.
 
int memory_handler (void *address, void *oldaddr, int type)
 Track all dynamic arrays allocated in libmsr to make deallocation simple.
 

Enumeration Type Documentation

Enum encompassing types of libmsr memory management.

Enumerator:
LIBMSR_FREE 
LIBMSR_MALLOC 
LIBMSR_CALLOC 
LIBMSR_REALLOC 
LIBMSR_FINALIZE 

Function Documentation

void* libmsr_calloc ( size_t  num,
size_t  size 
)

Allocate memory for an array of num elements of size bytes each with calloc().

Parameters
[in]sizeNumber of bytes.
[in]numNumber of elements.
Returns
Pointer to dynamic array.
void* libmsr_free ( void *  addr)

Free single dynamic memory allocation.

Parameters
[in]addrPointer to dynamic array.
Returns
Null pointer.
void* libmsr_malloc ( size_t  size)

Allocate size bytes with malloc().

Parameters
[in]sizeNumber of bytes.
Returns
Pointer to dynamic array.
void* libmsr_realloc ( void *  addr,
size_t  size 
)

Change allocation of existing memory to size bytes with realloc().

Parameters
[out]addrPointer to dynamic array.
[in]sizeNumber of bytes.
Returns
Pointer to dynamic array.
void* memhdlr_finalize ( void  )

Deallocate any remaining memory allocations and deallocate tracking structure.

Returns
Null pointer.
int memory_handler ( void *  address,
void *  oldaddr,
int  type 
)

Track all dynamic arrays allocated in libmsr to make deallocation simple.

Parameters
[out]addressPointer to dynamic array.
[out]oldaddrPointer to dynamic array.
[in]typelibmsr_mem_mgmt_e memory management identifier.
Returns
0 if successful, -1 if malloc() or realloc() fails.