deprecated delete and manual memory management

Alexander aldem+dmars at nk7.net
Thu Apr 28 16:59:52 PDT 2011


On 28.04.2011 18:17, Steven Schveighoffer wrote:

> It would seem making the metadata be a constant offset from the data page would be better, but of course, it cannot be that way for multi-page blocks.

  Why it cannot?

> If you have ideas on how to improve the performance, I encourage you to learn how the GC works and submit some patches!  It actually can be pretty fun.

  Probably I do, I'll take a look.

> Yes, the allocation and free performance could be improved, but it doesn't change the fact that delete manually is not a huge performance gain, if at all.

  I agree, just in some cases it is a gain, if not to performance, then to memory usage. Imagine a tight loop with aggressive GC , when collection is attempted on every allocation...

> If an object is to be collected, there will be no references to that object.  This means you do not have to scan that object's memory to see if it points to something else.  Less memory needs to be scanned.

  Right, but I still have to scan other objects and roots, which are still alive, and there can be many. Good GC shouldn't attempt a collection unless memory is tight, though.

  Anyway, I'll take a look into GC code, probably will make a benchmark to find out its weakness...

/Alexander


More information about the Digitalmars-d mailing list