Compare commits

...

2 Commits

Author SHA1 Message Date
8eea6251ce add: galloc: test allooc to big 2023-06-18 15:16:58 +02:00
8e437695a0 fix: add memory to galloc 2023-06-18 15:16:29 +02:00
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
define HEAP_SIZE = 0x030; define HEAP_SIZE = 0x8000;
global heap[HEAP_SIZE] = 0; global heap[HEAP_SIZE] = 0;
define PADDING_SIZE = 4; define PADDING_SIZE = 4;

View File

@ -1,3 +1,5 @@
global HEAP_SIZE = 0x0030;
main() main()
{ {
local ptr1; local ptr1;
@ -7,7 +9,11 @@ main()
ptr1 = galloc(1); ptr1 = galloc(1);
test_int(ptr1, heap + LOCATION_DATA, ""); test_int(ptr1, heap + LOCATION_DATA, "");
free(ptr1); free(ptr1);
ptr1 = galloc(1); ptr1 = galloc(1);
test_int(ptr1, heap + LOCATION_DATA, "alloc after free"); test_int(ptr1, heap + LOCATION_DATA, "alloc after free");
ptr2 = galloc(1); free(ptr1);
ptr2 = galloc(0x9000);
test_int(ptr2, 0, "alloc too big");
} }