I've encountered great resource about memory efficiency of huge java applications: http://domino.research.ibm.com/comm/research_people.nsf/pages/sevitsky.pubs.html/$FILE/oopsla08%20memory-efficient%20java%20slides.pdf
Main points of the presentation are:
- Representation overhead is sometimes huge
- Representation overhead not always diminshes with data size (!)
- Caches should have bounded size
- Many tiny strings consts you more than you think
Upon reading this paper you will
- Understand why your simple, low scale java app takes 2GB RAM
- How to use memory more efficiently
- Why and how to use good old mmap in java
- .. have a few good ideas for refactoring
This has been a very good and interesting paper for me, despite the fact I don't like java much. There is hacking spirit and great amout of war-field experience in it. Go read it if you are java pro.