mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-26 08:24:31 -04:00
Use calloc instead of malloc followed by memset
Avoids forcing pages to be allocated until actually needed.
This commit is contained in:
@@ -207,12 +207,11 @@ int game_main(int argc, char* argv[]) {
|
||||
// 2. Setup Virtual Game RAM
|
||||
// Simulates Gamecube RAM (24MB + Audio etc, we take 256MB)
|
||||
#define GAME_RAM_SIZE (256 * 1024 * 1024)
|
||||
void* virtualGameRam = malloc(GAME_RAM_SIZE);
|
||||
void* virtualGameRam = calloc(1, GAME_RAM_SIZE);
|
||||
if (!virtualGameRam) {
|
||||
printf("Fatal: Failed to allocate game RAM\n");
|
||||
return -1;
|
||||
}
|
||||
memset(virtualGameRam, 0, GAME_RAM_SIZE);
|
||||
OSSetArenaLo(virtualGameRam);
|
||||
OSSetArenaHi((char*)virtualGameRam + GAME_RAM_SIZE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user