On 7/16/23 11:41 PM, Alain De Vos wrote:
The following program prints two different addresses.
Meaning the new allocates memory until the program dies.
So the means memory leak by default ?
```
import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
void dofun(){
auto a=new int[1000];
writefln("%12x",&a);
destroy(a);
GC.free(a.ptr);
}
int main(){
dofun();
auto b=new int[1000];
writefln("%12x",&b);
return 0;
}
```
No, what I am trying to explain is that `destroy(a)` is literally
equivalent to `a = null`.
If you then `free(a)` do you think it does anything?
-Steve