Live data from Hacker News

What every programmer should know about memory (2007)

lwn.net

11–20 of 55 posts

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

#11
post #9

Article is from 2007. (And as someone else writes, details have changed and the article is rather detailed.)

>Article is from 2007.

Do you mean the article? Do you mean an article? There's a missing article in this comment.

Edit: downvoting doesn't make it any less true. However unrepentant about bad grammar you may be, the point stands and I don't regret the comment.

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

#12
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…

That will basically prohibit using most of C++ STL, for example. Premature optimization is the root of...

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

#13
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.

Or Java or go or ruby or Scala or php or....

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

#14
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…

You do know that function stack frames are dynamically allocated (just not from the heap in most C and C++ implementations).

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

#15

Earlier quoted context omitted.

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

Or Java or go or ruby or Scala or php or....

Still very much relevant in Java if you don't want your GC to churn like mad.

Heck even some of the cache aware algorithms can be taken advantage of with some smart use of ByteBuffers to get a 10-50x improvement in performance.

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

#17

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

Exactly. As the saying goes, whenever I hear "what every programmer needs to know about ...", I unsafety my Browning.

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

#18
What every programmer should know: large capacity and blazing fast NAND is poised to change everything you used to know. JEDEC is working on standardizing large capacity NVDIMMs [1][2][3], and that will probably mean at the very least a new tier in this hierarchy. And perhaps changes to swap, filesystems, databases, and boot/initialization will come to capitalize on this new tier.

[1] https://www.jedec.org/news/pressreleases/jedec-announces-sup...

[2] http://www.jedec.org/sites/default/files/files/Brett_William...

[3] https://en.wikipedia.org/wiki/NVDIMM

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

#19

What every programmer should know: large capacity and blazing fast NAND is poised to change everything you used to know. JEDEC is working on standardizing large capacity NVDIMMs [1][2][3], and that will probably mean at the very least a new tier in this hierarchy. And perhaps changes to swap, filesystems, databases, and boot/initialization will come to capitalize on this new tier. [1] https://www.jedec.org/news/press…

Unless they get CAS latency down(the little I know about flash points to probably not) I don't know if it's going to change that much.

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

#20

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

Wrong. Every programmer should know this stuff. You may not be directly manipulating memory in python, but you should know enough about memory (and other scarce resources) to know when you need to optimize your application. How are you going to know when you need to use __slots__ in python? Should java programmers just blindly throw -Xms when they think they need it? How should they justify that?

We have GB and GB of memory in our computers today, but all of the "I don't have to worry about memory constraints" have snowballed. The application we run today are nowhere near as efficient as they could be otherwise.

Post reply on HN