Live data from Hacker News

What every programmer should know about memory (2007)

lwn.net

1–10 of 55 posts

Re: What every programmer should know about memory (2007)

#5
there are just three things i wish programmers knew about memory... none of them are especially low-level or require depth of understanding.

never dynamically allocate it unless forced.

really. never allocate at run-time it unless you are absolutely forced by your algorithm.

if you absolutely really must allocate memory on the fly, have a budget so you can do one big up-front allocation and carefully reuse it. even better, don't allocate it to start with.

Re: What every programmer should know about memory (2007)

#6
this is way to low level for every programmer to know. While there probably is some use for this, the average java/python/ruby/node.js programmer will never need this information.

When working with embedded systems this information is more usefull, but very few programmers actually do work in that industry compared to others, e.g. web

Re: What every programmer should know about memory (2007)

#7
post #5

there are just three things i wish programmers knew about memory... none of them are especially low-level or require depth of understanding. never dynamically allocate it unless forced. really. never allocate at run-time it unless you are absolutely forced by your algorithm. if you absolutely really must allocate memory on the fly, have a budget so you can do one big up-front allocation and carefully reuse it. even b…

I feel like you are projecting your domain specific experience on a larger more general audience than is appropriate.

Re: What every programmer should know about memory (2007)

#8
post #5

there are just three things i wish programmers knew about memory... none of them are especially low-level or require depth of understanding. never dynamically allocate it unless forced. really. never allocate at run-time it unless you are absolutely forced by your algorithm. if you absolutely really must allocate memory on the fly, have a budget so you can do one big up-front allocation and carefully reuse it. even b…

I'll remember that the next time I'm using python.

Re: What every programmer should know about memory (2007)

#10
post #2

I would love to read an updated version of this. The fundamentals won't have changed much. But the details are changing and Urlich went into a lot of detail in this doc. Great Read.

Wiki could work for updating this writeup efficiently, good example is the way linux booting was described using github.

https://github.com/0xAX/linux-insides

Post reply on HN