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:
parent
7dc3e2e00c
commit
16a1872035
2
heap.c
2
heap.c
|
@ -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;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue