Skip to content

On free() #15

@mcandre

Description

@mcandre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions