Example #1
0
PoolAllocator & PoolAllocator::operator=(const PoolAllocator &v)
{
	allocSize = v.allocSize;
	tmpSpace = v.tmpSpace;
	deallocateAll();
	return *this;
}
Example #2
0
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;
}
 Allocator::~Allocator(void)
 {
   deallocateAll();
 }
Example #4
0
		/**
		* Destructor, frees all memory if scoped_release was specified.
		*/
		~Allocator()
		{
			if(scoped_release)
				deallocateAll();
		}
Example #5
0
AreaMemoryManager::~AreaMemoryManager() {
    deallocateAll();
}