"proven" libraries and what's in there?
I just made some experiments with the hprof-feature of the JVM as we had some memory problems on our tomcat.
There, I discovered a single object using 262152 bytes... after some analysis, I found this snippet of source code:
private static final String PADDING = new String[Character.MAX_VALUE];
I guess you find this as intriguing as I do. I don't want do discuss a solution or best practice here - my point is:
this piece comes from StringUtils, from the well-known commons lang library (v2.1). So, we have ~ 30 apps running on one tomcat, which sums up to something like 8MB memory usage just for this crap (alright, there's the common/lib/ directory - but is it save to put that lib in there? probably it is, but especially now, I wouldn't count on that).
I wonder which other "leaks" are hidden in there and other commonly used libraries. Do you check the libraries you are using? Did anybody notice similar "pitfalls"? I wonder how good an idea it is using such "all-purpose" libraries if you could also set up your own Util classes - providing just the 3,4 methods you need.
Yeah i know. Who checks my code and now that this is uncovered and all is open source, this flaw will probably be fixed in the next release. But nevertheless...
What do you think about this?
Message was edited by: sebastiankirsch