Christoph Thiede uploaded a new version of System to project The Trunk: http://source.squeak.org/trunk/System-ct.1444.mcz
==================== Summary ====================
Name: System-ct.1444 Author: ct Time: 9 January 2024, 8:11:21.160382 pm UUID: d3468d51-cc4d-a44f-8aad-6900e10ba2cc Ancestors: System-dtl.1442
MessageTally: Moves clean-up of timed process spying into an ensure block, analogously to sibling methods. Fixes a memory leak.
=============== Diff against System-dtl.1442 ===============
Item was changed: ----- Method: MessageTally>>spyEvery:onProcess:forMilliseconds: (in category 'initialize-release') ----- spyEvery: millisecs onProcess: aProcess forMilliseconds: msecDuration "Create a spy and spy on the given process at the specified rate." | myDelay observedProcess sem | (aProcess isKindOf: Process) ifFalse: [self error: 'spy needs a Process here']. self class: aProcess suspendedContext receiver class method: aProcess suspendedContext method. "set up the probe" observedProcess := aProcess. myDelay := Delay forMilliseconds: millisecs. time0 := Time millisecondClockValue. endTime := time0 + msecDuration. sem := Semaphore new. gcStats := Smalltalk getVMParameters. Timer ifNotNil: [ self error: 'it seems a tally is already running' ]. Timer := [ [ startTime := Time millisecondClockValue. myDelay wait. self tally: Processor preemptedProcess suspendedContext in: (observedProcess == Processor preemptedProcess ifTrue: [ observedProcess ] ifFalse: [ nil ]) "tally can be > 1 if ran a long primitive" by: (Time millisecondClockValue - startTime) // millisecs. startTime < endTime ] whileTrue. sem signal. ] newProcess. Timer priority: Processor timingPriority-1. "activate the probe and evaluate the block" Timer resume. "activate the probe and wait for it to finish" + [sem wait] ensure: [ + self class terminateTimerProcess. + self computeGCStats. + time := Time millisecondClockValue - time0]! - sem wait. - self computeGCStats. - time := Time millisecondClockValue - time0!
packages@lists.squeakfoundation.org