FFI ExternalStructure - proper memory cleanup

John M McIntosh johnmci at smalltalkconsulting.com
Sun Jan 21 06:27:20 UTC 2007

Sure in the class initialization method

	Smalltalk addToStartUpList: self.
or perhaps
	Smalltalk addToStartUpList: self after: ExternalSettings.
to ensure you are added to the master startup list somewhere rationally.

I'll note in Sophie we had an interesting issue once where the  
startup logic for Rome based Fonts was startedUp via just the  
but one day we rebuilt a test image and discovered if it managed to  
add the rome logic AFTER morphic startup which would paint the  
windows we were hosed.
Therefore we had to ensure we added our rome logic BEFORE morphic .

and of course startup would be

startUp: resuming
		ifFalse: [^ self].
	self dosomething...

Ah and resuming is true when... Exercise for the reader, one case is  
when you save the image, one case is when the image is restarted by  
restarting the virtual machine.

On Jan 20, 2007, at 7:53 PM, Jim McLoughlin wrote:

> Thanks to Bert and John for the quick responses, I think I understand
> how to handle cleaning up my instances.
>> You can of course as earlier noted have a class side startup method
>> an nil out instance vars for all instances when the VM is started...
> Anyone have a quick example on how to do this?  I tried to put it in
> my GSLMatrix class>>initialize, which already exists to define the
> structure fields.  I also tried declaring a class side method startUp,
> but neither seemed to be invoked on image restart.
> Did I need to somehow register the startUp method with the image
> startup process?
> Jim

John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com

More information about the Squeak-dev mailing list