std.process: memory allocation with malloc in execv_

kdevel kdevel at vogtner.de
Fri Jan 27 20:26:03 UTC 2023


On Thursday, 26 January 2023 at 14:45:29 UTC, Steven 
Schveighoffer wrote:
[...]
> Yep, that's 100% the problem.  Introduced here: 
> https://github.com/dlang/phobos/commit/6302257b0cdc5d171511cc6f1566956ff11b09c5
>
> Amazing it's been broken like this for 7 years!

*shrug*

> I don't like the solution of adding the range, or using the GC. 
> A better option is to replace toAStringz with a function that 
> creates everything for you into a type (toStringz isn't 
> complex, just replace with one that uses malloc), that then 
> automatically frees everything.

Freeing the memory is — in the "happy path" — neither required 
nor possible. When unhappy the GC is ready to clean up the mess. 
I uploaded a patch to the issue.

How do I check my patched version without editing the module name 
in process.d? Either I don't get the functions linked into the 
executable or the linker complains about duplicate symbols.


More information about the Digitalmars-d mailing list