cAudio 2.3.0
3d Audio Engine
Loading...
Searching...
No Matches
cStandardMemoryProvider.cpp
1// Copyright (c) 2008-2011 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones, Murat (wolfmanfx) Sari
2// This file is part of the "cAudio Engine"
3// For conditions of distribution and use, see copyright notice in cAudio.h
4
5#include "cStandardMemoryProvider.h"
6#include "cMemoryTracker.h"
7#include <stdlib.h>
8#include <limits>
9
10#ifdef max
11 #undef max
12#endif
13
14#ifdef min
15 #undef min
16#endif
17
18namespace cAudio
19{
20 void* cStandardMemoryProvider::Allocate(size_t size, const char* filename, int line, const char* function)
21 {
22 void* ptr = malloc(size);
23#if CAUDIO_USE_MEMORYTRACKER == 1
24 cMemoryTracker::Instance()->AddAllocation(ptr, size, filename, line, function);
25#endif
26 return ptr;
27 }
28
30 {
31 if(pointer)
32 {
33#if CAUDIO_USE_MEMORYTRACKER == 1
34 cMemoryTracker::Instance()->RemoveAllocation(pointer);
35#endif
36 free(pointer);
37 }
38 }
39
41 {
42 return std::numeric_limits<size_t>::max();
43 }
44};
virtual size_t getMaxAllocationSize()
Returns the largest possible single allocation that can be made.
virtual void Free(void *pointer)
Frees memory previously allocated.
virtual void * Allocate(size_t size, const char *filename, int line, const char *function)
Allocates memory and returns a pointer to it.
Main namespace for the entire cAudio library.
Definition: cAudioCapture.h:16