Skip to content

Commit

Permalink
(Vita) Add user-defined heap size
Browse files Browse the repository at this point in the history
  • Loading branch information
frangarcj committed Jul 22, 2021
1 parent e8da2b1 commit 855e4a9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions newlib/libc/sys/vita/sbrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <reent.h>

int _newlib_heap_memblock;
extern unsigned int _newlib_heap_size_user __attribute__((weak));
unsigned _newlib_heap_size;
char *_newlib_heap_base, *_newlib_heap_end, *_newlib_heap_cur;

Expand Down Expand Up @@ -29,8 +30,12 @@ void _init_vita_heap(void) {
if (sceKernelCreateLwMutex(_newlib_sbrk_mutex, "sbrk mutex", 0, 0, 0) < 0) {
goto failure;
}
// Create a memblock for the heap memory, 32MB
_newlib_heap_size = 32 * 1024 * 1024;
if (&_newlib_heap_size_user != NULL) {
_newlib_heap_size = _newlib_heap_size_user;
} else {
// Create a memblock for the heap memory, 32MB
_newlib_heap_size = 32 * 1024 * 1024;
}
_newlib_heap_memblock = sceKernelAllocMemBlock("Newlib heap", 0x0c20d060, _newlib_heap_size, 0);
if (_newlib_heap_memblock < 0) {
goto failure;
Expand Down

0 comments on commit 855e4a9

Please sign in to comment.