can you update the StrutsSpringTestCase in the repository? Many Thanks for this important discovery and the solution!
Saludos Cordiales desde EEUU Martin ______________________________________________ Porfavor no modifica o interrupta esa communicacion/Please do not modify or interrupt this communication > Date: Tue, 9 Mar 2010 11:46:43 +0100 > From: carl.ballant...@cast-info.es > To: u...@struts.apache.org > Subject: StrutsSpringTestCase - Memory Leak > > Hi All, > > I ran into an issue with the StrutsSpringTestCase class when doing my > unit tests. Basically the memory kept climbing until it crashed the > machine. > > This class is actually loading the applicationContext for every test > case that extends it. And because the applicationContext is static the > instances of the spring beans loaded are not cleaned up by the garbage > collector. > > What I ended up doing was overriding the method with the following in > my base test class for Struts 2. The only difference being the check > to see if applicationContext is null. This has the added benefit of > speeding up the tests. > > protected void setupBeforeInitDispatcher() throws Exception { > // only load beans from spring once > if (applicationContext == null) { > GenericXmlContextLoader xmlContextLoader = new > GenericXmlContextLoader(); > applicationContext = > xmlContextLoader.loadContext(getContextLocations()); > } > > servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, > > applicationContext); > } > > Hope this helps anyone who runs into the same issue. > Cheers, > Carl. > > > *Advertencia legal: en virtud de lo establecido en la Ley Organica 15/1999 de > Proteccion de Datos de Caracter Personal, le informamos de que los datos > personales que pueda facilitarnos se incorporaran a un fichero automatizado > titularidad de CAST INFO, S.A. con la finalidad de gestionar la relacion > negocial que nos vincula. Podra revocar su consentimiento al tratamiento de > los datos, asi como ejercer sus derechos de acceso, rectificacion, > cancelacion u oposicion dirigiendose por escrito a CAST INFO domiciliada en > C/ Tuset 23, 1 -- 08006 Barcelona, o a la direccion de correo electronico > l...@cast-info.es. > > Este mensaje y los ficheros anexos que pueda contener son confidenciales, > pueden contener informacion sometida a secreto profesional y se dirige > exclusivamente a su destinatario. Si ha recibido este mensaje por error o > tiene conocimiento del mismo por cualquier motivo, le rogamos que nos lo > comunique inmediatamente por este mismo medio y se abstenga de utilizarlo, > reproducirlo, alterarlo, archivarlo o comunicarlo a terceros. El emisor no se > responsabiliza de posibles perjuicios derivados de la captura, > incorporaciones de virus o cualesquiera otras manipulaciones efectuadas por > terceros. > > Antes de imprimir este e-mail piense bien si es necesario hacerlo. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > _________________________________________________________________ Hotmail: Powerful Free email with security by Microsoft. http://clk.atdmt.com/GBL/go/201469230/direct/01/