pharo-vm icon indicating copy to clipboard operation
pharo-vm copied to clipboard

The Simulation of the Memory Allocation should correctly handle next available address

Open tesonep opened this issue 3 years ago • 0 comments

When a chunk of memory is requested in the simulation (using the simulated malloc, calloc, etc) if the actual position of the memory is not equal to the desired position, the recording of the next available address is not correctly updated.

In SlangMemoryManager >> #allocate:desiredPosition: nextAvailable address should be updated as:

nextAvailableAddress := allocatedAddress + allocatedSize.

The issue can be reproduced by doing:

[
	HFAllocationEvent {
		#id : 77,
		#objectType : #array,
		#objectSize : 100000,
		#isNew : true,
		#isRoot : true
	},
	HFAllocationEvent {
		#id : 79,
		#objectType : #array,
		#objectSize : 100000,
		#isNew : false,
		#isRoot : true
	},
	HFOldSpaceCollectionEvent { },
	HFAllocationEvent {
		#id : 85,
		#objectType : #array,
		#objectSize : 100000,
		#isNew : false,
		#isRoot : true
	},
	HFOldSpaceCollectionEvent { }
]

tesonep avatar Oct 17 '22 14:10 tesonep