aboutsummaryrefslogtreecommitdiff
path: root/src/lib/memutils.cpp
blob: e12b2080ff01e050f4e41c8086945130ea972f5a (plain)
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
#include <stdlib.h>
#include <iostream>
#include "memutils.h"
#define MEMDEBUG 0
void* memutils::mymalloc(const char* wherefrom,__uint32 elcount,__uint32 elsize)
{
	void* q=calloc(elcount,elsize);
#if (MEMDEBUG==1) 
	cout 	<< "ALLOC: " << wherefrom 
		<<" allocated " 
		<< elcount<<" bytes at " << q << endl;
#else
	wherefrom=NULL;
#endif
	return q;
}

void memutils::myfree(const char* wherefrom,void* freewhat)
{
#if (MEMDEBUG==1) 
	cout << "FREE: "<< wherefrom <<" free bytes at " << freewhat << endl;
#else
	wherefrom=NULL;
#endif
	free(freewhat);
}