Relative Content

Tag Archive for allocation

Does assigning NULL in a GC’ed Environment have similar effects to using free()?

I was just writing a function (in C# in this case) that stored huge amounts of data in a local variable early on in the code, let’s say at 5% of the functions code.
After that point, the data in this memeory are no longer used,
also the following 95% of code have a variable runtime, as part of it depends on external ressources.
My Idea was (inspired by C) to ‘actively free’ that block of memory.
In an evironment with a GC this is mostly just plain impossible.

Does assigning NULL in a GC’ed Environment have similar effects to using free()?

I was just writing a function (in C# in this case) that stored huge amounts of data in a local variable early on in the code, let’s say at 5% of the functions code.
After that point, the data in this memeory are no longer used,
also the following 95% of code have a variable runtime, as part of it depends on external ressources.
My Idea was (inspired by C) to ‘actively free’ that block of memory.
In an evironment with a GC this is mostly just plain impossible.