Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 67654 invoked from network); 13 Jan 2010 21:31:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2010 21:31:59 -0000 Received: (qmail 73450 invoked by uid 500); 13 Jan 2010 21:31:59 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 73409 invoked by uid 500); 13 Jan 2010 21:31:59 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 73354 invoked by uid 99); 13 Jan 2010 21:31:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 21:31:58 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of kurt.stam@gmail.com designates 74.125.92.24 as permitted sender) Received: from [74.125.92.24] (HELO qw-out-2122.google.com) (74.125.92.24) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 21:31:49 +0000 Received: by qw-out-2122.google.com with SMTP id 5so77905qwd.57 for ; Wed, 13 Jan 2010 13:31:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=tqcgmbZNE2aMJQUXsJ0nEPnWR7FliMvJs2geOyZGldE=; b=LR2DlgEZ5ug2Gs+w1Pj6Rz/zyCuthKj0g85MDBAwc/S4t7VMOaImNOTujT3gEbvc0g h9juD2BUoYzprLKrLsDfCdwW6ZF6y1rNAKMpH22gk6pAiTPeJGqHUchSgmEQQlZYNN7u 8CMk60JrVQ9Lev33wuSPfroCRNxzIH5yDb1VQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=WOGvWIlk4Ji1ouDZys4zZBDb9iQUdiUY5YA/5hMqWIBDQH2+d9WsrxK7bYCOkin+vR vKQnr3ym0WOndYi7lktOlWl676OPGWv+56KSZZKaDXpvcq3iwiGzOAXAvfGzHa+yfpbq AueGOvzTVZcRHfb9ovpM5xccT1/oVMBnKRd4g= Received: by 10.224.34.231 with SMTP id m39mr2933632qad.188.1263418288358; Wed, 13 Jan 2010 13:31:28 -0800 (PST) Received: from macdaddy.local (c-24-34-53-42.hsd1.ma.comcast.net [24.34.53.42]) by mx.google.com with ESMTPS id 21sm5623917qyk.8.2010.01.13.13.31.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 Jan 2010 13:31:27 -0800 (PST) Message-ID: <4B4E3BAE.7010109@gmail.com> Date: Wed, 13 Jan 2010 16:31:26 -0500 From: Kurt T Stam User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: users@openjpa.apache.org Subject: Re: memory leak? - simple question References: <4B4E0E47.8040005@gmail.com> <4B4E2777.9090701@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Rick, thank you for you quick response. My comments inline. Rick Curtis wrote: > If you change the 1000 to something like 1000000... does your application go > OOM? Yep it does. > Are you running in a JSE environment? running in tomcat. > What is PersistenceManager? > http://svn.apache.org/repos/asf/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/config/PersistenceManager.java The code referenced below is based on http://svn.apache.org/repos/asf/webservices/juddi/trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISecurityImpl.java I just added the loop to make the problem more obvious. This method is called from a web service client. > On Wed, Jan 13, 2010 at 2:05 PM, Kurt T Stam wrote: > > >> BTW I'm running with the cache off >> >> >> >> (that turns it off right?) >> >> --Kurt >> >> >> >> Kurt T Stam wrote: >> >> >>> Hi guys, >>> >>> [DESCRIPTION] The code below inserts a 1000 records in the database. >>> >>> for (int i=1; i<1000; i++) { >>> EntityManager em = PersistenceManager.getEntityManager(); >>> EntityTransaction tx = em.getTransaction(); >>> try { >>> tx.begin(); >>> // Generate auth token and store it! >>> String authInfo = AUTH_TOKEN_PREFIX + UUID.randomUUID(); >>> org.apache.juddi.model.AuthToken modelAuthToken = new >>> org.apache.juddi.model.AuthToken(); >>> if (authInfo != null) { >>> modelAuthToken.setAuthToken(authInfo); >>> modelAuthToken.setCreated(new Date()); >>> modelAuthToken.setLastUsed(new Date()); >>> modelAuthToken.setAuthorizedName(publisherId); >>> modelAuthToken.setNumberOfUses(0); >>> modelAuthToken.setTokenState(AUTHTOKEN_ACTIVE); >>> em.persist(modelAuthToken); >>> } >>> apiAuthToken = new org.uddi.api_v3.AuthToken(); >>> MappingModelToApi.mapAuthToken(modelAuthToken, >>> apiAuthToken); >>> tx.commit(); >>> } finally { >>> if (tx.isActive()) { >>> tx.rollback(); >>> } >>> em.clear(); >>> em.close(); >>> } >>> } >>> >>> >>> [ISSUE] >>> After it leaving this code I end up with a 1000 >>> org.apache.juddi.model.AuthToken objects in memory. I've been using the >>> profiler, and these objects cannot be garbage collected. >>> >>> This seems to be pretty the most common use case of using an OR-mapping >>> tool, so I find it hard to believe openjpa has a memory leak here. Does >>> anyone see what I'm doing wrong? Or can someone point me to an example that >>> does not exhibit this behavior? BTW same code using hibernate does not >>> accumulate these objects. >>> >>> We're using openjpa 1.2.1. >>> >>> >>> Thx, >>> >>> >>> Kurt >>> >>> Apache jUDDI. >>> >>> >> > > >