Closed
Description
Hi, I think there's a bug in gc_realloc, after calling it a few times it returns NULL even though there's enough memory to satisfy the request.. This is the code I'm using to test:
void test_realloc()
{
printf("testing realloc\n");
void *mem = gc_alloc(100);
for (int i=1; i<=50; i++) { /* ~50K */
mem = gc_realloc(mem, 1000*i);
printf("realloc: %d\n", 1000*i);
if (mem==NULL) {
pyb_info();
printf("\r\n");
sys_tick_delay_ms(5000);
__asm__ volatile ("BKPT");
}
}
}
I call test_realloc()
after running the main script in main.c
This is the result:
realloc: 37000 <<< stops here
ID=29003600:0a473133:32353735
S=168000000
H=168000000
P1=42000000
P2=84000000
_text_end=8043b50
_data_start_init=8043b50
_data_start=20000000
_data_end=200001fc
_bss_start=20000200
_bss_end=20001f78
_stack_end=20020000
_ram_start=20000000
_heap_start=20001f78
_heap_end=2001c000
_ram_end=20020000
qstr:
n_pool=1
n_qstr=17
n_str_data_bytes=213
n_total_bytes=309
GC:
104960 total
used: 37888 free:67072 <<--- 67K remaining
1=52 2=2 m=2250
LFS free: 30720 bytes
Code is compiled with optimization and tested on discovery board... Can you confirm this ?
Metadata
Metadata
Assignees
Labels
No labels