Hacker News new | ask | show | jobs
by atq2119 2311 days ago
> Another example might be a compiler; it's pointless to deallocate all your structures manually before calling exit().

And now the compiler can no longer be embedded into another application, e.g. an IDE.

It's a reasonably pragmatic way of thinking, but beware the consequences. One benefit of working with custom allocators is that you can have the best of both worlds. Unfortunately, custom allocators are clumsy to work with.

1 comments

Solve the problem you have now, not the problem you may not have later. You can worry about that when the time comes, if it ever comes.

In the case of compiler, one solution would be to replace all calls to `malloc` with something like `ccalloc` that simply returns pieces of a `realloc`'d buffer which is freed after the in-IDE compiler has finished compiling.