Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 35772 invoked from network); 9 Mar 2010 13:38:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Mar 2010 13:38:23 -0000 Received: (qmail 54480 invoked by uid 500); 9 Mar 2010 13:37:53 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 53717 invoked by uid 500); 9 Mar 2010 13:37:53 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 53701 invoked by uid 99); 9 Mar 2010 13:37:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 13:37:53 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mgainty@hotmail.com designates 65.55.111.85 as permitted sender) Received: from [65.55.111.85] (HELO blu0-omc2-s10.blu0.hotmail.com) (65.55.111.85) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Mar 2010 13:37:51 +0000 Received: from BLU142-W4 ([65.55.111.71]) by blu0-omc2-s10.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 9 Mar 2010 05:37:30 -0800 Message-ID: Content-Type: multipart/alternative; boundary="_92cfb2a6-530c-44b1-ab20-2d107d97a62c_" X-Originating-IP: [71.232.81.102] From: Martin Gainty To: Struts Users Mailing List , Subject: RE: StrutsSpringTestCase - Memory Leak Date: Tue, 9 Mar 2010 08:37:30 -0500 Importance: Normal In-Reply-To: <20100309114643.3t3ee54iw8o8ow8k@mail.cast-info.es> References: <20100309114643.3t3ee54iw8o8ow8k@mail.cast-info.es> MIME-Version: 1.0 X-OriginalArrivalTime: 09 Mar 2010 13:37:30.0727 (UTC) FILETIME=[AA9E3770:01CABF8D] --_92cfb2a6-530c-44b1-ab20-2d107d97a62c_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable can you update the StrutsSpringTestCase in the repository? Many Thanks for this important discovery and the solution! Saludos Cordiales desde EEUU Martin=20 ______________________________________________=20 Porfavor no modifica o interrupta esa communicacion/Please do not modify or= interrupt this communication > Date: Tue=2C 9 Mar 2010 11:46:43 +0100 > From: carl.ballantyne@cast-info.es > To: user@struts.apache.org > Subject: StrutsSpringTestCase - Memory Leak >=20 > Hi All=2C >=20 > I ran into an issue with the StrutsSpringTestCase class when doing my =20 > unit tests. Basically the memory kept climbing until it crashed the =20 > machine. >=20 > This class is actually loading the applicationContext for every test =20 > case that extends it. And because the applicationContext is static the =20 > instances of the spring beans loaded are not cleaned up by the garbage =20 > collector. >=20 > What I ended up doing was overriding the method with the following in =20 > my base test class for Struts 2. The only difference being the check =20 > to see if applicationContext is null. This has the added benefit of =20 > speeding up the tests. >=20 > protected void setupBeforeInitDispatcher() throws Exception { > // only load beans from spring once > if (applicationContext =3D=3D null) { > GenericXmlContextLoader xmlContextLoader =3D new =20 > GenericXmlContextLoader()=3B > applicationContext =3D =20 > xmlContextLoader.loadContext(getContextLocations())=3B > } > =20 > servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CO= NTEXT_ATTRIBUTE=2C =20 > applicationContext)=3B > } >=20 > Hope this helps anyone who runs into the same issue. > Cheers=2C > Carl. >=20 >=20 > *Advertencia legal: en virtud de lo establecido en la Ley Organica 15/199= 9 de Proteccion de Datos de Caracter Personal=2C le informamos de que los d= atos personales que pueda facilitarnos se incorporaran a un fichero automat= izado titularidad de CAST INFO=2C S.A. con la finalidad de gestionar la rel= acion negocial que nos vincula. Podra revocar su consentimiento al tratamie= nto de los datos=2C asi como ejercer sus derechos de acceso=2C rectificacio= n=2C cancelacion u oposicion dirigiendose por escrito a CAST INFO domicilia= da en C/ Tuset 23=2C 1 -- 08006 Barcelona=2C o a la direccion de correo ele= ctronico lopd@cast-info.es. >=20 > Este mensaje y los ficheros anexos que pueda contener son confidenciales= =2C pueden contener informacion sometida a secreto profesional y se dirige = exclusivamente a su destinatario. Si ha recibido este mensaje por error o t= iene conocimiento del mismo por cualquier motivo=2C le rogamos que nos lo c= omunique inmediatamente por este mismo medio y se abstenga de utilizarlo=2C= reproducirlo=2C alterarlo=2C archivarlo o comunicarlo a terceros. El emiso= r no se responsabiliza de posibles perjuicios derivados de la captura=2C in= corporaciones de virus o cualesquiera otras manipulaciones efectuadas por t= erceros. >=20 > Antes de imprimir este e-mail piense bien si es necesario hacerlo. >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: user-unsubscribe@struts.apache.org > For additional commands=2C e-mail: user-help@struts.apache.org >=20 =20 _________________________________________________________________ Hotmail: Powerful Free email with security by Microsoft. http://clk.atdmt.com/GBL/go/201469230/direct/01/= --_92cfb2a6-530c-44b1-ab20-2d107d97a62c_--