Use calloc instead of malloc followed by memset

Avoids forcing pages to be allocated until actually needed.
This commit is contained in:
PJB3005
2026-02-24 15:17:47 +01:00
parent 818b190bb5
commit e5cfe0e6b4
+1 -2
View File
@@ -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);