aspose file tools*
The moose likes Java in General and the fly likes Usage of Resource Bundles and Memory consumption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Usage of Resource Bundles and Memory consumption" Watch "Usage of Resource Bundles and Memory consumption" New topic
Author

Usage of Resource Bundles and Memory consumption

sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi
When we use resource bundles, does all the contents of a given resource bundle gets loaded into memory or do they get loaded only as and when used.
I was wondering, if defining multiple Resource Bundles for different parts of an application would reduce the memory consumption.
Please let me know.
Thanks
Sumit


SCEA, SCBCD, SCJP1.4, OOAD-UML, OCP 9i
brad balmer
Ranch Hand

Joined: Mar 08, 2004
Posts: 57
I'm assuming you mean using a ResourceBundle to read in a propery file and if the entire property file is read in at one time?
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Yes, that is what I wanted to know.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
yes, the entire file is read in at once.
For performance reasons you might therefore want to declare them as static and/or use a Singleton pattern to access them.
Something like the stuff Eclipse generates for you when you externalise Strings from an application would do nicely:


42
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi
Thanks for your valuable input.
So when is the file read - when the first Key is Read ??
Sumit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Usage of Resource Bundles and Memory consumption