3 ms·
fork(), malloc(), exit() when done.
by gpderetta 4y ago
fork(), malloc(), exit() when done.
- coldtea 4y agoHow is that "automatic memory management"?
- gpderetta 4y agoIt is a brute force arena allocator. No free needed. But mostly a joke.
- flohofwoe 4y agoIt's a completely valid memory management strategy for "one-shot" command line tools though.
- rwmj 4y agoIt is. Unfortunately when I tried to use it in a particular product, I got so much negative feedback from our Coverity and other static analysis tools that I have given in and added calls to free everywhere.
- mort96 4y agoIt's more than that. It's a "valid" strategy even for long lived servers. Fork, do the thing which requires heap memory in the child, then exit the child (but the parent keeps running).
- wheelerof4te 4y agoWith smart missiles, you don't even need that exit().
- alexeiz 4y agoWho needs exit() when you have kill().