On Thursday, 28 February 2019 at 03:33:25 UTC, Sam Johnson wrote:
How can I get the GC to automatically garbage collect the `output` malloc call by tracking the returned `ret` reference?
If you want it GC managed, just GC allocate it instead of mallocing it.
char *output = cast(char *) malloc(output_length); replace with char* output = (new char[](output_length)).ptr; and the rest of your code can remain the same.
Or is this already managed by the gc because I cast to a `string`?
no, a cast only affects the type system