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;
}

```

  • Re: How to free ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: How to ... Alain De Vos via Digitalmars-d-learn
      • Re: How... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: How... Steven Schveighoffer via Digitalmars-d-learn
        • Re:... Alain De Vos via Digitalmars-d-learn
          • ... Alain De Vos via Digitalmars-d-learn
            • ... Steven Schveighoffer via Digitalmars-d-learn
          • ... Steven Schveighoffer via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Alain De Vos via Digitalmars-d-learn
            • ... drug007 via Digitalmars-d-learn
              • ... Alain De Vos via Digitalmars-d-learn
                • ... drug007 via Digitalmars-d-learn
              • ... Alain De Vos via Digitalmars-d-learn
    • Re: How to ... Nick Treleaven via Digitalmars-d-learn

Reply via email to