Created Saturday 07 September 2013
Different types of memory:
- +HeapSpace - contains objects (i.e., whenever you use "new" keyword, this is where object goes)
- stack - methods, local variables, and reference variables. Each method call has its own frame on the stack.
- code - bytecode
- static - static data/methods
- Watch out for static mutable objects---don't store mutable non-threadsafe classes
- Object pooling is in general inefficient unless the objects are very expensive to create. See http://www.ibm.com/developerworks/java/library/j-jtp01274/index.html
- Explicit nulling is often bad unless you really will cause a memory leak. (Don't help the GC).
Links
- http://www.offthehill.org/articles/2011/06/03/java-static-variables-are-wrong-almost-always/
- http://tech.puredanger.com/2009/01/27/java-concurrency-bugs-mutable-statics/
- https://blog.codecentric.de/en/2010/01/the-java-memory-architecture-1-act/
- http://www.ibm.com/developerworks/library/j-codetoheap/
No backlinks to this page. comments powered by Disqus