Originally posted by A Len:
So, what is more memory expensive, given about 20 simultaneous users, calling toUpperCase when passing values into a database, or described above?
Originally posted by ALeX:
For 10 new records submitted by multiple users, containing about 30 fields each, 20 are strings that are capitalized, there are no memory problems? If these operations are indeed short-lived and do not affect JVM's performance, then I'll look for other problems.
Originally posted by David Harkness:
Let's assume the average string size for those fields is 40 characters. So with 20 string fields per object, a base size of 12 bytes for a String, and 2 bytes per character, you're using about 1840 bytes for temporary uppercase versions of those fields per object. Of course, the non-uppercased fields that came from the web layer are also temporary and of the same size.
This isn't much memory, and it's happening all the time. If your JVM is recent, it should have an improved GC that deals with temporary object creation more robustly. I suspect there's a bigger problem somewhere, whether you're caching too many objects or keeping references around that should be nulled.
Consider Paul's rocket mass heater. |