Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On free() #15

Open
mcandre opened this issue Dec 14, 2018 · 1 comment
Open

On free() #15

mcandre opened this issue Dec 14, 2018 · 1 comment

Comments

@mcandre
Copy link

mcandre commented Dec 14, 2018

Compilers may be short-lived programs, but they often capitalize on a large amount of memory even when they are using free(). For example, installing dependencies in C, C++, Java, Node.js, and Haskell tends to require upwards of 4GB of memory on build machines. Some operating systems / dev tool pairs are more efficient, using <1GB of memory. But in general, compilation tends to be one of the most memory-intensive things you can do! And I'm not talking about building complex projects like the Linux kernel or video games, I'm talking about absolute minimum requirements to build small-to-medium size middleware projects you'd find on GitHub.

I think 8cc/9cc is a cool project, but for building projects of realistic size, it is probably worth freeing memory whenever we can. Otherwise, many projects may require more buildtime memory hardware than a typical laptop offers. Does that make sense?

I do think it is cool to think about different memory styles, like skipping free() closer to the end of main() functions... But valgrind isn't smart enough to handle that, so I tend to put them there anyway :P

@odeits
Copy link

odeits commented Dec 16, 2018

The D reference compiler doesn't free() in order to improve performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants