GC collecting "too much"..

bearophile bearophileHUGS at lycos.com
Sun Mar 25 13:18:02 PDT 2012


On Sunday, 25 March 2012 at 19:15:05 UTC, simendsjo wrote:
> I'm doing some coding against a c library, and Ds GC keeps 
> collecting c owned objects (I think - disabling the GC makes 
> everything work)

Three alternative solutions:
- Allocate from the C heap the memory that C will need to use, 
and free it manually or in a struct destructor (RAII) or with 
scope(exit).
- Keep a pointer to the D-GC memory in the D code too.
- In core.memory there are ways to disable scanning of a memory 
zone. Maybe it's usable for your purposes too.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list