On Wednesday, 2 April 2014 at 15:45:06 UTC, Andrea Fontana wrote:

auto example(char* test) { return toStringz(to!string(test) ~ " world!"); }

When that return string will be freed?

What about:

extern(C) auto example(....)

?

to!string allocates on the GC heap when given a char* (it has to, in order to safely produce immutable data in the string).

It will be freed by the first garbage collection ocurring after all references to that memory are dead.

Reply via email to