On Thu, Dec 11, 2014 at 11:42 AM, Cosmin Apreutesei <cosmin.apreutesei@xxxxxxxxx> wrote: >> Even if there was some way to tell the GC about that 'other' >> memory, the (incremental) GC will see the memory pressure after >> the first 10 GB allocation, but it could never catch up at that >> pace or that granularity relative to the total amount of memory. > > Pardon my ignorance, but I thought (i.e. just assumed) that the GC > looks at bytes allocated since the last GC step, when deciding how > much to collect in the current step, so if 10G were allocated since > the last step, the current step should not stop until either 10G is > freed or all dead objects are freed. Your answer indicates that it's > more complicated than that. > > I'm asking because I always wondered why there's no size arg to > ffi.gc() -- would that not help much then? > The part you're missing is that the gc only keeps track of memory allocated BY LUA. If you explicitly allocate additional memory, it doesn't track that. /s/ Adam