[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: optimising table creation; garbage collection
- From: Damian Stewart <damian@...>
- Date: Wed, 23 Aug 2006 14:31:50 +1200
hi
i'm writing some code that at the moment does a lot of dynamic table
creation, ie local bob = {}.
in order to get around this i thought of writing a RunTimeTableManager
object which manages a table pool, and which i can query for new tables
each time i want one, ie local bob = RunTimeTableManager.NewTable(), at
which point the table is removed from the RunTimeTableManager's pool.
what would be nice is for the tables to automatically return themselves to
the RunTimeTableManager's pool when they were done with being used. can i
do this with the garbage collector? if each table i return from
RunTimeTableManager.NewTable() has a __gc method which pushes the table
back into the RunTimeTableManager's pool, will this cause things to explode
in ugly ways?
cheers
d
--
f r e y
live music with machines
http://www.frey.co.nz