C Language Development Kit/Functions/ClearHeap
From OptiWiki
| Description | This function clears the heap system, used by malloc and the RAM disk. |
| Syntax | void clearheap(void); |
| Arguments | None |
| Returns | None |
| Remarks | Please note that a call to this function might corrupt the RAM disk, since this uses the same memory area, so a format of the RAM disk is then advised.
To format the RAM disk, make sure that the default drive is set to the RAM disk (see set_default_drive) and call the functon format. It is also possible to call the function format2, where you can specify the drive to format. |
| Example | #include <stdio.h> #include <stdlib.h> #include "lib.h" void main( void ) { printf("\fPress any to\nstart format\n"); while( getchar() == EOF ) idle(); clearheap(); format2( RAM_DISK ); while(1) idle(); } |
