When this will be freed?
Jacob Carlborg
doob at me.com
Wed Apr 2 08:53:51 PDT 2014
On 2014-04-02 17:45, Andrea Fontana wrote:
> auto example(char* test) { return toStringz(to!string(test) ~ " world!"); }
>
> When that return string will be freed?
When there is no reference left to the string, the garbage collector is
free to collect it when it chooses to.
> What about:
>
> extern(C) auto example(....)
Same as above, extern(C) does not change how memory is collected. If it
is a C function, then it depends entirely on that particular function.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list