After lurking on the Perl6-lists and finally catching up on this long 
discussion about garbage collection, I'm coming out ;-).

The reason I'm coming out is that I realised that we should maybe have a 
radically different view on garbage collection than we have now.

Think about it:

1: in an ideal world with unlimited resources, who would need garbage 
collection anyway?  Or: simple oneliners and small scripts don't need GC.

2: limited resources may appear still available when in fact, they are 
not.  E.g. a limit on the total number of simultaneous database connections 
as seen from the database server, not the Perl process.  The Perl process 
still thinks it can open connections, when in fact the database server is 
already saturated.

3: some resources may not be needed temporarily, but should become 
available magically when needed.  E.g. virtual memory, database connections 
that re-connect automatically after a disconnect (for whatever reason).

4: As a Perl programmer, I don't care whether a file-handle has been closed 
because of resource management, as long as it is available to me when I 
need it.  I don't care whether a connection to a database server has been 
re-used by other database server users, as long as I have a connection 
(transparently) when I need it.

5: As a server administrator, I would like to be able to limit the 
available memory to a Perl program or maximum number of database 
connections, so that it behaves nicely towards other users of that server.


I think this calls for a resource management system, rather than a garbage 
collection system.  A resource management system with an API with which 
resources (their creation, cleanup and destruction routines) can be 
registered.  No garbage collection (which implies a not well thought out 
"way of life" to me) but planned ahead resource management (know in advance 
what you need when) for situations that need it.  (I guess my Dutch 
background is showing here, wanting to have everything neatly organised ;-).

This resource management system would ideally include a (pluggable) virtual 
memory system for Perl itself (Perl may be able to know better what to 
temporarily store on disk than any OS would).

It would include the file IO subsystem.

It would include the handling of any external connections (such as 
connections to databases).

Or any other resource that is in limited availability.


And of course, such a resource management system should degrade to a 
"everything is free" approach for simple one-liners and small scripts, like 
the current situation.



Elizabeth Mattijsen


P.S. Dan: I hope you don't mind not waiting for your PDD, but this seemed 
too important to me for the train of thought about garbage collection at 
this point in time.

Reply via email to