AudRecordLib
Classes | Typedefs | Functions
alloc.cpp File Reference

Implements memory management, and the default function used if no user defined one have been specified. More...

#include "stdafx.h"
#include "alloc.h"
#include <set>
#include <memory>

Classes

struct  StraightHeapAlloc< Type >
struct  StraightHeapAlloc< Type >::rebind< Other >

Typedefs

typedef std::set< PrefixData
*, std::less< PrefixData * >
, StraightHeapAlloc
< PrefixData * > > 
AllocList

Functions

struct __declspec (align(16)) PrefixData
void DisplayOutstandingAllocs ()
void *__cdecl operator new (size_t bytes)
void *__cdecl operator new[] (size_t bytes)
void __cdecl operator delete (void *ptr)
void __cdecl operator delete[] (void *ptr)
PVOID SetAllocFreeFunctionsInternal (pfnAlloc allocFn, pfnFree freeFn, PVOID pData)
BOOL InitialiseAlloc (HMODULE)
void UninitialiseAlloc (HMODULE)

Detailed Description

Implements memory management, and the default function used if no user defined one have been specified.


Typedef Documentation

typedef std::set<PrefixData*, std::less<PrefixData*>, StraightHeapAlloc<PrefixData*> > AllocList

Set of allocation pointers typedeffed for clarity


Function Documentation

struct __declspec ( align(16)  ) [read]

Data added to the start of each allocation

This ensures that data allocated by one allocator will be freed by it's partner free, even if the global pointers are changed between the alloc and free

Function to free the allocation

The user data at the time of allocation

The stack at the time of allocation

void DisplayOutstandingAllocs ( )

Displays any unfreed allocations allong with their stack trace via both the ETW debug stream and OutputDebugString

BOOL InitialiseAlloc ( HMODULE  hModule)

Initialises the allocation part of AudRecordLib

Parameters:
hModuleThe HMODULE of the AudRecord dll, unused
Returns:
Whether initialisation was succesful
void __cdecl operator delete ( void *  ptr)

Overloaded object deleter that frees either with free or with the user defined deleter

void __cdecl operator delete[] ( void *  ptr)

Overloaded object array deleter that frees either with free or with the user defined deleter

void* __cdecl operator new ( size_t  bytes)

Custom object allocator that allocates either with malloc or with the user defined allocator

void* __cdecl operator new[] ( size_t  bytes)

Custom array allocator that allocates either with malloc or with the user defined allocator

PVOID SetAllocFreeFunctionsInternal ( pfnAlloc  allocFn,
pfnFree  freeFn,
PVOID  pData 
)

Overrides the default or previous alloc and free functions with user defined versions

Parameters:
allocFnThe allocation function
freeFnThe free function
pDataThe user data to pass to the functions
Returns:
The previous value of the user data, on first call this is the process heap handle
void UninitialiseAlloc ( HMODULE  hModule)

Destroys the allocation info part of AudRecordLib

Parameters:
hModuleThe HMODULE of the AudRecord dll, unused
Returns:
Whether initialisation was succesful
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines