Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm pretty sure the Boehm GC isn't heap compacting.

It at least didn't used to be, and if it is it works in some way I cannot fathom, as I'm not sure how you can compact the heap without changing the value of pointers, which the Boehm GC cannot do safely.

That said it's still a very good GC and you should be fine. (It does try to minimize fragmentation in other ways, but nothing is as effective as heap compacting.)



Niklas (the RoboVM lead dev) talked briefly about how the GC is used on the list here: https://groups.google.com/d/msg/robovm/etAxWMYvRTU/huXKmPA-J...

If I understand correctly, when used in "precise" mode, the Boehm GC is capable of compacting. Mono north of version 2.8 also claims to be heap compacting by virtue of Boehm in precise mode.


I'm afraid that you are mistaken about the capabilities of the Boehm GC when it comes to compacting. It doesn't compact so heap fragmentation is a possibility with RoboVM. Mono 2.8 introduced SGen [0] which is a totally separate GC developed by the Mono project. It is a compacting GC and is now the default IIUC.

/Niklas

[0] http://www.mono-project.com/Working_With_SGen


Ah, I stand corrected.

(I had drawn my impression of Mono from https://en.wikipedia.org/wiki/Boehm_garbage_collector#Uses_a... 's current statement: "The Boehm GC is used by many projects that are implemented in C or C++, as well as by runtime environments for a number of other languages, including [...], the Mono implementation of the Microsoft .NET platform (also using precise compacting GC since version 2.8)"... which evidentially is referring to "also" a different GC entirely, rather than a mode as I had thought.)

Do you know of any good resources that explain more about the precise vs conservative scanning modes of Boehm?

I thought I recalled some references to a precise mode available via a "GC_MALLOC_ATOMIC" function in Boehm which would understand all of the contained data to be not-pointers and thus enable smarter handling, but perhaps that's a necessary-but-not-sufficient thing on the road to heap compacting. I'm hitting a lot of dead links looking for more information sadly; hpl.hp.com seems to have suffered a reorganization lately :(

EDIT: http://hboehm.info/gc/ appears to be the living mirror of http://www.hpl.hp.com/personal/Hans_Boehm/gc/ and contains useful documentation and FAQs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: