您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

umalloc_test.c 486B

1234567891011121314151617181920212223242526
  1. #include <stdio.h>
  2. #include <gpxe/uaccess.h>
  3. #include <gpxe/umalloc.h>
  4. #include <gpxe/memmap.h>
  5. void umalloc_test ( void ) {
  6. struct memory_map memmap;
  7. userptr_t bob;
  8. userptr_t fred;
  9. printf ( "Before allocation:\n" );
  10. get_memmap ( &memmap );
  11. bob = umalloc ( 1234 );
  12. bob = urealloc ( bob, 12345 );
  13. fred = umalloc ( 999 );
  14. printf ( "After allocation:\n" );
  15. get_memmap ( &memmap );
  16. ufree ( bob );
  17. ufree ( fred );
  18. printf ( "After freeing:\n" );
  19. get_memmap ( &memmap );
  20. }