Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 95961 invoked from network); 24 May 2010 10:32:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 24 May 2010 10:32:48 -0000 Received: (qmail 56474 invoked by uid 500); 24 May 2010 10:32:48 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 56358 invoked by uid 500); 24 May 2010 10:32:46 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 56350 invoked by uid 99); 24 May 2010 10:32:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 May 2010 10:32:45 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of websystemz@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 May 2010 10:32:38 +0000 Received: by vws19 with SMTP id 19so177708vws.16 for ; Mon, 24 May 2010 03:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=4VX+qP0eoIeQ07sOS4pU1womN++46o64fWN+Wl/ygpI=; b=o+OO+7+9YJA8PjY4WmFLG3LEIoLXYBjCwGj5UD66NznGbLdpZxt5UiXa+rwf6DBUN4 83JTLeXBsiNI9Ji9Twr92YuLlFwcczgJYjHY9Y3mZprROnk5t9etWRsgv3PndgSc9knt Q+S1s9vt6DrvYYWC2Szti53WmNah/hD7vXXgg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Dau2JLggZw7Rms5jU+JTzJSi3wdoTo8VQRBjXaIpDX+xrYdBTd6DURxPXZYhu3TVLS vIcuiS7BXvIT/6TYQOd+C4zSsEqR8PzPSY9sGYdqrgDHEfil7MrG0O1tWobqkpTFskt8 yr4HPHIBaWn6JfaM8bbOZebIVseUFoi7ov3o0= MIME-Version: 1.0 Received: by 10.220.62.134 with SMTP id x6mr3619141vch.188.1274697137477; Mon, 24 May 2010 03:32:17 -0700 (PDT) Received: by 10.220.48.105 with HTTP; Mon, 24 May 2010 03:32:17 -0700 (PDT) In-Reply-To: References: Date: Mon, 24 May 2010 20:32:17 +1000 Message-ID: Subject: Re: OutOfMemory with large number of inserts From: Steve Wells To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=e0cb4e887a61135a230487548e7e X-Virus-Checked: Checked by ClamAV on apache.org --e0cb4e887a61135a230487548e7e Content-Type: text/plain; charset=ISO-8859-1 Typical Cayenne users exceedingly fast helpful answers! I've tried a few more things based on your replies but nothing positive so far. Andrey, I am only creating *most* new objects in datacontext. But I am selecting the related (master a.k.a 'rel') data-objects and "connecting" them to the detail objects in the order of 1-2000 (could be 1-1 or 1-3000). one thing I did notice was that I was selecting the 'rel' object using shared cache. I set cache to NONE for that select and all the create/inserts ran approx twice as fast (I do have some basic timings in place). Perhaps this is an interesting separate thread of discussion. Juergen, yes I already had a new ObjectContext for each CSV and I was commiting each 400 (and 200 and 1000 etc). I also created a new ObjectContext at the same point, though I expect moving the 'related' object to the new Context may negate the point of creating the new context...so same result. Andrus, I've deleted the reverse relationship and the same issue persists. What I did do was remove the forward relationship 'l.setToRelatedObject(rel)' and it all worked fine...no OutOfMemory. But I do need both relationship directions. At least I have some direction in which to try. Thanks all for your help. On 24 May 2010 17:21, Juergen Saar wrote: > First try: use a new ObjectContext for each csv-File ... > > If this doesn't solve the memory-problem you should try to make a commit > after let's say 200 inserts and then create a new ObjectContext ... > > 2010/5/24 Steve Wells > > > Hi All, > > > > I am importing from a lot of csv files (2200+) and each csv has between 0 > > and 3000 rows, each row will create a new DataObject in a DataContext etc > : > > > > The code is simple enough and distilled here is: > > > > for each csv file > > RelatedObj rel = getRelatedObj() > > for each line in csv file > > Line l = new Line() > > l.setxxx for each column of csv // 5 cols are set > > l.setToRelatedObject(rel) > > dataContext.registerNewObject(l) > > end for each line in csv file > > dataContext.commitChanges() > > end > > > > This goes well for a while but no matter how high I set the heap size I > > eventually get OutOfMemoryException....I can see the speed of each commit > > slowdown over time as the heap size is diminshed. > > > > I have tried a few different ways around this but all end up the same. > > Initially tuning the SQL server instance, but everything points to > objects > > in memory not being de-allocated. > > > > Has anyone had experience with Cayenne (3.0RC3) and this number of > inserts > > they could advise with? > > > > Cheers, > > > > Steve > > > --e0cb4e887a61135a230487548e7e--