java - How can I configure Spring to save as much memory as possible? -


We are deploying an application on a semi-embedded device that has memory barriers, whatever we can do To save we are analyzing the pile dump of apes and attacking the largest consumers.

We use Spring 2.5 with Spring DM1 and we see that some of our bundles are using memory much more complex spring contexts because the spring holds around the whole object graph in which All the beadfinions that were parsed from XML I thought most of these are unnecessary after the start of the app and everything is injected.

Is there a configuration option for Spring that allows this behavior to be controlled? Run in some low memory mode? Throw all the unnecessary things? Business calculation time for size?

I had a deep sense of side and some interesting results. Its default configuration in Spring is not particularly interested in its memory usage in being conservative, two fundamental aspects can be touched for significant benefits:

  • Spring OsiziBandLuxLapplificationContax For the first time, there is a non-exposed asset for the first time, which you can extend from that category and override the customizeBeanFactory method

We Did it Land:

  Customize zero protected override @ Krenfinsficr (Difoltlesteblbinfiattr Binfaccr) {super.customizeBeanFactory (beanFactory); String cacheMetadataSystemprop = system.jetproper (CACHE_BEAN_METADATA, "true"); If (cachephinematasisprop! = Null & amp; cache beamametadaycephrase.Ageel Ignore case ("fottal")) {Bean Factor.Setacabatadata (wrong); } And if (cachephinematasisprop! = Null & amp; cash beammetaiseprof. Azel ignarce ("true")) {bonfactility. Satcabatadata (true);   

Setting "setCacheBeanMetadata" property to false Beandiffinion (basically your XML based configuration's programmatic mirror) creates Can be left after doing.

  • The second change - that we currently have a prototype - is a patches to start sluggish collection of spring source code, it has been found that many internal spring objects that represent beans And all his qualities are a lot of members, which are started by the hashmaps and other collections by default, but very few are filled with data, to start these lazards. Changing the Spring Framework will save one more significant amount of memory, but this is a more aggressive change.

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -