On Saturday, 19 November 2022 at 19:16:41 UTC, Jack Pope wrote:
On Thursday, 17 November 2022 at 22:05:45 UTC, jwatson-CO-edu wrote:
[`Atom`](https://github.com/jwatson-CO-edu/SPARROW/blob/main/lil_schemer.d#L66) 
(unit of data), I throw it on the heap and never bother to delete it.  [...]


If you wish to automatically de-allocate the oldest atoms, one approach might be to put them in a ring buffer. Its size will affect the relative time needed for deleting and overwriting the oldest elements. You can hard code the size based on experimentation or allow ongoing automatic adjustment based on some formula.

I think there are some interesting ring buffer packages in the DUB registry.

Thank you, but I do not think the atoms will be freed in order, especially those holding user-defined functions. A ring buffer would be more appropriate for processing items in a stream or for otherwise implementing a queue.

Reply via email to