mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-14 15:21:32 +00:00
Quick and dirty test for emalloc()
This commit is contained in:
parent
45ec9c907e
commit
132a8fe49d
26
src/tests/emalloc_test.c
Normal file
26
src/tests/emalloc_test.c
Normal 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 );
|
||||
}
|
Loading…
Reference in New Issue
Block a user