I had a thought in the shower today (dont ask… i have my best ideas there )
In this day and age, where harddrive storage space is ridiculously cheap and most people have tonnes of free space, is there any realy need in most applications for any “Real” collection of garbage?
The benefits should be no real long pauses
A naive impelmentation might be similar to this:
for each “new” instance created allocate required memory. Add to top of Objects-in-RAM-Queue (ORQ).
On request for a particular instance’s memory address the following will happen:
- if the instance is in the ORQ, return the memory address. Add to top of Objects-in-RAM-Queue (ORQ).
- else if the instance in the Add to Disk Cache Map(DCM). Remove from DCM and add to top of Objects-in-RAM-Queue (ORQ).
a GC thread will periodically monitor the last time stamp (mabe cpu cycle count? ) of the last instance in the ORQ if the instance the time stamp indicates the instance is old then remove the instance from the ORQ and add to the DCM. Repeat this until GC thread time exceeded or last instance is too young.
where the ORQ utlises “normal” RAM and DCM utilises a harddrive or similar.
alternatively perhaps just let the OS deal with the memory requests and manage the paging to disc and so just always allocate memory, never destroy?