david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Quick and dirty test for emalloc()

This commit is contained in:
Michael Brown 2007-01-12 03:27:05 +00:00
parent 45ec9c907e
commit 132a8fe49d
1 changed files with 26 additions and 0 deletions

26
src/tests/emalloc_test.c Normal file
View File

@ -0,0 +1,26 @@
#include <vsprintf.h>
#include <gpxe/uaccess.h>
#include <gpxe/emalloc.h>
#include <gpxe/memmap.h>
void emalloc_test ( void ) {
struct memory_map memmap;
userptr_t bob;
userptr_t fred;
printf ( "Before allocation:\n" );
get_memmap ( &memmap );
bob = emalloc ( 1234 );
bob = erealloc ( bob, 12345 );
fred = emalloc ( 999 );
printf ( "After allocation:\n" );
get_memmap ( &memmap );
efree ( bob );
efree ( fred );
printf ( "After freeing:\n" );
get_memmap ( &memmap );
}