mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
[3DS] Free memory in 1MB blocks
When freeing large blocks of memory, the 3DS may kernel panic. Freeing in smaller blocks seems to avoid the crashes.
This commit is contained in:
parent
d34c427f3f
commit
5756ff0b16
1 changed files with 6 additions and 3 deletions
|
@ -141,9 +141,12 @@ void* _sbrk_r(struct _reent *ptr, ptrdiff_t incr)
|
|||
|
||||
__heap_size += diff;
|
||||
|
||||
if (diff < 0)
|
||||
svcControlMemory(&tmp, __heapBase + __heap_size,
|
||||
0x0, -diff, MEMOP_FREE, MEMPERM_READ | MEMPERM_WRITE);
|
||||
while (diff < 0) {
|
||||
int size = -diff < 0x100000 ? -diff : 0x100000;
|
||||
diff += size;
|
||||
svcControlMemory(&tmp, __heapBase + __heap_size - diff,
|
||||
0x0, size, MEMOP_FREE, 0);
|
||||
}
|
||||
|
||||
sbrk_top += incr;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue