mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +03:00
Quick and dirty test for emalloc()
This commit is contained in:
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 );
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user