void MapObjectLoader::allocateMainData(INIFile* mapFile, const std::string& name) { Log::line("Allocating map objects now for '" + name + "'...", Log::DEBUG); allocateAll(House::Array, mapFile, "Houses"); allocateAll(TeamType::Array, mapFile, "TeamTypes"); allocateAll(TaskForce::Array, mapFile, "TaskForces"); allocateAll(ScriptType::Array, mapFile, "ScriptTypes"); }
int runVm(int argc, char ** argv) { parseArguments(&argc, &argv); if(optImageFile == NULL) { printf("No image file specified.\n\n"); printUsage(); return 255; } if(!optInteractive && optScript == NULL && optScriptFile == NULL) { printf("No script specified.\n\n"); printUsage(); return 255; } allocateAll(); loadImageFile(optImageFile); passArguments(argc, argv); if(optInteractive) { repl(); } else { processScript(); } deallocateAll(); if(optPrintStatistics) { printf("\x1b[2m"); printf("\nMemory statistics:\n- objects allocated: %ld\n- size allocated: %.2lf MB\n", totalObjectsAllocated, (double) totalMemoryAllocated / 1000000 * sizeof(OP)); printf("\nGarbage collection statistics:\n- runs in new space: %d\n - avg new space reclaimed: %.2f %%\n - min new space reclaimed: %.2f %%\n - objects moved to old space: %ld\n- runs in old space: %d\n - avg old space reclaimed: %.2f %%\n - min old space reclaimed: %.2f %%\n", gcCount, gcCount ? (gcPercentSum / gcCount) : 0.0, gcCount ? gcPercentMin : 0.0, gcObjectsMovedToOld, gcOldCount, gcOldCount ? (gcOldPercentSum / gcOldCount) : 0.0, gcOldCount ? gcOldPercentMin : 0.0); printf("\x1b[0m"); } return 0; }