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.

Reply via email to