Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

My memory gobbling loop causes the gc to perform badly. Why?

0
Posted

My memory gobbling loop causes the gc to perform badly. Why?

0

The loop you are running is likely not releasing any bytes of heap for the amount it is allocating. A loop similar to (compile (defun gobble () (loop for x from 1 to 1000000000000000000000000 with k = 0 do (incf k) (when (= k 10000000) (print “.”) (setq k 0)) collect x))) (gobble) is likely generating almost no garbage. Allegro CL’s garbage collector makes decisions about how much space to allocate based on the gsgc-parameters that are currently set, and the effect of this loop is to throw the calculations into a non-linear area where the only thing it can do is to cause the heap to grow at a huge rate of increase. Most real programs never run this way; either they don’t cons at all, or at least some of the consing done is ephemeral, even if only a few percent of the total consing. And, of course, any program which continues to cons permanent space should be considered leaky, unless it is explicitly a test to gobble up all of memory, and to see how such gobbling progresses. To get bett

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.