I'm still trying to get my head around this 'Weak Reference' thing, but since
I'm still working to be compatible with PHP5.2 then I've not taken much notice
of this 'garbage collection' stuff. So this may be where I am missing something?
I manage what material I need using a list of numbers, and create objects as and
when they are required, pulling the detail from the database. There is a limit
on the amount of memory available, so in the past I got 'out of memory', now I
just say 'some detail not available'. If I'm out of space, then I reuse an
existing object that is 'invalid', but to simplify things then much of the time
I don't ACTUALLY need the full record, and simply build the page via the one
object which is sequentially loaded ... slower, but memory efficient. Never do
'SELECT * FROM', always specify just the fields you need at that time.
So it looks like the question I should be asking is "How do you 'drop' an
object?" I think my take on this 'Weak Reference' stuff is that it does not
actually 'create' the object? But I am creating the object because I need to use
it, not because I may need it later? I'll get the database server to do any
heavy processing ... and that may well be a different machine ... I just want
the results. So I try to avoid pulling unnecessary data into the PHP side - I
can only put so much on a client page.