Full garbage collection throughtout the system.

Bijan Parsia bparsia at email.unc.edu
Wed Dec 12 19:40:33 UTC 2001


On Wed, 12 Dec 2001, Eric Scharff wrote:

[snip]

> I try to be careful to call close on any FileStream and socket that I
> create in my own code.

Good.

>  (I further assume that any system code that I call
> that opens file streams also closes them, like
>  HTTPSocket httpShowGif: 'whatever'

Eh...maybe not so wise :)

> Two questions:
> 
> 1) Is it helping to do these calls to close?

Sure! Best to do the call in an exception handler, e.g.,

	[blah blah blah] ensure: [file close]

That way it gets closed even if there's an error.

> 2) Is it essential, or do the resources eventually get freed in a GC?

No and pretty much yes.

(GC performs finalization and socket/file instance creation will trigger a
fullGC in a variety of circumstances.)

However, there are surely cases where you could have a file or socket
which is, for all intends and purposes, dead, but still has pointers too
it, so won't get finalized.

Cheers,
Bijan "Violator of his own preachings" Parsia.





More information about the Squeak-dev mailing list