Now allocating heap using malloc() on UNIX

git-svn-id: http://picoc.googlecode.com/svn/trunk@431 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2010-06-13 11:31:19 +00:00
parent 7dc3e2e00c
commit 16a1872035
2 changed files with 3 additions and 2 deletions

2
heap.c
View file

@ -216,7 +216,7 @@ void *HeapAllocMem(int Size)
void HeapFreeMem(void *Mem) void HeapFreeMem(void *Mem)
{ {
#ifdef USE_MALLOC_HEAP #ifdef USE_MALLOC_HEAP
return free(Mem); free(Mem);
#else #else
struct AllocNode *MemNode = (struct AllocNode *)((char *)Mem - MEM_ALIGN(sizeof(MemNode->Size))); struct AllocNode *MemNode = (struct AllocNode *)((char *)Mem - MEM_ALIGN(sizeof(MemNode->Size)));
int Bucket = MemNode->Size >> 2; int Bucket = MemNode->Size >> 2;

View file

@ -38,7 +38,8 @@
/* host platform includes */ /* host platform includes */
#ifdef UNIX_HOST #ifdef UNIX_HOST
# define HEAP_SIZE (128*1024) /* space for the heap and the stack */ # define HEAP_SIZE (128*1024) /* space for the the stack */
# define USE_MALLOC_HEAP /* heap is allocated using malloc() */
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include <ctype.h> # include <ctype.h>