I can't remember where I read it though, in documentation
probably, the `free` function calls the `delete` function as
well, and it can be used to remove object from memory.
Since there is garbage collector in the background already, you
don't have to do it in this way (and I am not doing as well), but
you are able.
While writing the message, found the documentation.
http://dlang.org/phobos/core_memory.html#.GC.free
On Wednesday, 26 February 2014 at 09:14:42 UTC, Bienlein wrote:
Hello,
ich found this article on the Internet that explains how to do
malloc and free in D:
http://fgda.pl/post/8/a-look-at-the-d-programming-language See
the functions named _new and _delete. My question is whether
this is really the way to allocate and free some memory for a
class manually in D. Because I just did this playing around
with D and it seems to work:
class D {
public int i;
}
void main(string[] args)
{
auto d = new D();
delete(d);
d.i = 123; // creates Access Violation as expected
}
The article confused me. Is the contents outdated or am I
messing something up?
Thanks for shedding any light on this for me ;-).
Regards, Bienlein