简体   繁体   中英

Installing libgc on OSX (Boehm's Garbage Collector)

I've started by using reference counting in my library I'm making. It's a pretty decent solution and the increments and decrements don't waste many resources as some people wrongly seem to think. Also the slight extra memory for reference counts is negligible.

But apparently tracing garbage collection is so good that it is better than using malloc/free. I'm not sure if this is true so I'd like to try it out (Back-end optimisations by freeing multiple objects at once?). Also GC would make my library easier to use, as calling retain/release functions is not needed.

Edit: The problem is that gc/gc.h includes itself infinitely. This makes no sense...

Thanks.

The question is rather vague. do you want to know how to use libgc in general or do you want to know how to get it working on mac OS X? if later is the case then I recommend using Homebrew. It has a pretty decent formula for libgc. just use the command:

brew install libgc

this will install the library in /usr/local/Cellar/libgc/7.6.0 depending on the latest version available in HomeBrew formula.

the confusion you have regarding gc.h referring to itself infinitively is actually not true. because there is another gc.h in the gc subfolder which the first gc.h is including. I have no idea why they have designed it like this though!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM