On Saturday, 4 January 2014 at 17:16:53 UTC, Adam D. Ruppe wrote:
On Saturday, 4 January 2014 at 17:15:12 UTC, Jeroen Bollen
wrote:
Is there a way to prevent the Garbage collector from running
on one particular object? Something like:
I would just malloc it.
int* CreatePermanentInt() {
int* i = malloc(int.sizeof);
*i = 5;
return i;
}
The malloced thing itself won't be freed, nor will its contents
be scanned by the gc (unless you use GC.addRange yourself) so
you can use it to hack some weak references too.
Do I get malloc from the C library or does D also have a function
for this?