69,6 → 69,7 |
} |
|
static size_t heapsize = 0; |
static size_t maxheapsize = (size_t)(-1); |
/* Start of heap linker symbol */ |
extern char _heap; |
|
91,6 → 92,8 |
/* Check for too small values */ |
if (incr < 0 && incr+heapsize > heapsize) |
return NULL; |
/* Check for user limit */ |
if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL; |
|
rc = as_area_resize(&_heap, heapsize + incr,0); |
if (rc != 0) |
103,3 → 106,11 |
|
return res; |
} |
|
void *set_maxheapsize(size_t mhs) |
{ |
maxheapsize=mhs; |
/* Return pointer to area not managed by sbrk */ |
return (void *)&_heap + maxheapsize; |
|
} |