Installing libgc on OSX (Boehm's Garbage Collector)

老子叫甜甜 提交于 2021-01-27 18:40:22

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/10678440/installing-libgc-on-osx-boehms-garbage-collector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!