File: dynmm_smartheap.cpp

package info (click to toggle)
open-amulet 4.3.1-7.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,804 kB
  • ctags: 9,779
  • sloc: cpp: 97,058; sh: 7,698; ansic: 1,881; makefile: 756; lisp: 153; exp: 15
file content (35 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef DYNMM_SMARTHEAP_CPP
#define DYNMM_SMARTHEAP_CPP

#ifdef USE_SMARTHEAP
	#include <heapagnt.h>
#endif

Dyn_Memory_Manager::Dyn_Memory_Manager(size_t aObjectSize, char *aPoolName)
			{
				mMemoryPool = MemPoolInitFS(aObjectSize,10,MEM_POOL_DEFAULT);
				dbgMemPoolSetName(mMemoryPool, aPoolName);
// 				if(mMemoryPool == MEM_OUT_OF_MEMORY) 
// 				{                                    
// 					throw bad_allocation;
// 				}                                    
			}

			//:Releases the allocated memory-pool with one call
Dyn_Memory_Manager::~Dyn_Memory_Manager()
			{
				MemPoolFree(mMemoryPool);
			}

void Dyn_Memory_Manager::Delete(void *ptr)
			{
				MemFreeFS(ptr);
				return;
			}

void *Dyn_Memory_Manager::New()
			{
				return(MemAllocFS(mMemoryPool));
			}

#endif