From odf-users-return-28-apmail-incubator-odf-users-archive=incubator.apache.org@incubator.apache.org Thu Oct 20 08:50:52 2011 Return-Path: X-Original-To: apmail-incubator-odf-users-archive@minotaur.apache.org Delivered-To: apmail-incubator-odf-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F2FA74CF for ; Thu, 20 Oct 2011 08:50:52 +0000 (UTC) Received: (qmail 65347 invoked by uid 500); 20 Oct 2011 08:50:52 -0000 Delivered-To: apmail-incubator-odf-users-archive@incubator.apache.org Received: (qmail 65297 invoked by uid 500); 20 Oct 2011 08:50:50 -0000 Mailing-List: contact odf-users-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: odf-users@incubator.apache.org Delivered-To: mailing list odf-users@incubator.apache.org Received: (qmail 65284 invoked by uid 99); 20 Oct 2011 08:50:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2011 08:50:47 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of neelima.b@gmail.com designates 209.85.214.47 as permitted sender) Received: from [209.85.214.47] (HELO mail-bw0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2011 08:50:42 +0000 Received: by bkat8 with SMTP id t8so3476598bka.6 for ; Thu, 20 Oct 2011 01:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=jJgmQcgoALPpkt0VZVng5sra7i0Z7cdro4JCN60JQE0=; b=Jcb59Yxhs1Q3dhBiF8ssKwA07jj48/ZteE9jE85pDVnKr0nwBw31tkGvGO6dgwt3lu oeEfjvCiSvqvkzHeL8s5DSh4NUq0NQxPcDKIZnVHCDKRVRBPgDxCT1bjEXrrIPWFlbtL BEWegypNVBoWROC/3av/SmXsS7hFmWV6I5LyU= MIME-Version: 1.0 Received: by 10.204.152.205 with SMTP id h13mr7453226bkw.91.1319100621060; Thu, 20 Oct 2011 01:50:21 -0700 (PDT) Received: by 10.204.59.208 with HTTP; Thu, 20 Oct 2011 01:50:21 -0700 (PDT) In-Reply-To: References: Date: Thu, 20 Oct 2011 14:20:21 +0530 Message-ID: Subject: Re: Memory issues using Simple ODF From: Neelima To: odf-users@incubator.apache.org Content-Type: multipart/alternative; boundary=0015175defb8f0f92e04afb70b05 --0015175defb8f0f92e04afb70b05 Content-Type: text/plain; charset=ISO-8859-1 Hi Devin, Yes, it was from me and I followed what you have suggested. Currently the sample.ods doesn't reach the max rows or max columns when we first load. I just kept the rows and columns to the minimum and i am appending whenever needed. To be precise, column count is 4 and rowCount differs with each sheet max being 300. I will try the other options suggested in the meantime and will let you know the results. Thanks, Neelima On Thu, Oct 20, 2011 at 1:53 PM, Devin Han wrote: > I query the mail archive and get this post: > Updating ODS file using ODFDOM version 0.8.7 > > http://odftoolkit.org/projects/odfdom/lists/users/archive/2011-07/message/10 > > It is also from you;) I think you face the same problem this time ;) > > 2011/10/20 Neelima > > > Hi, > > > > I have used ODF API for writing information into an ODS file. Following > are > > the steps: > > > > 1. Load an ODS document from a location which acts as a template f or > > writing information. (Spead across different workSheets) > > > > *SpreadsheetDocument ods = > > SpreadsheetDocument.loadDocument("Sample.ods");* > > * > > * > > 2. Load the record from the database. > > 3. Write information of retrieved record from the database across > different > > spreadsheets. > > * //fetch rows and cell* > > * cell.setStringValue("value");* > > * > > * > > 4. Append columns/rows when necessary as I progress loading each record > and > > write to the ODS file. > > * Table sheet = ods.getSheetByIndex(0);* > > * sheet.appendColumn();* > > * //when I need to append rows* > > * sheet.appendRows(2);* > > * //when I have to insertRows* > > * sheet.insertRowsBefore(8,2);* > > > > 5. Repeat steps 2-4 until all records are written to the database. At > the > > end save the document to the desired location > > *ods.save("Sample_Output.ods");* > > * ods.close();* > > * > > * > > When our program is running and when we calculate memory usage by object > > ods, > > for every item its increasing to many folds and finally if we have around > > 500 records to be written to the file, it runs to OutOfMemory error even > > with a JVM heap size of 512M. We have a requirement wherein we have to > > write > > atleast a couple of 1000 records to the file. > > Below are some of the readings we have taken for the memory occupied by > ods > > object (all in bytes): For 25 items it took almost 19MB of memory. > > > > *Memory used for item start when template ods file is loaded : 70904* > > * > > Memory used for item 1 is::6582856 > > Memory used for item 2 is::7153712 > > Memory used for item 3 is::7693304 > > Memory used for item 4 is::8229752 > > Memory used for item 5 is::8790632 > > Memory used for item 6 is::9330904 > > Memory used for item 7 is::9872280 > > Memory used for item 8 is::10403760 > > Memory used for item 9 is::10926408 > > Memory used for item 10 is::11444312 > > Memory used for item 11 is::11975584 > > Memory used for item 12 is::12569264 > > Memory used for item 13 is::13111056 > > Memory used for item 14 is::13630656 > > Memory used for item 15 is::14162408 > > Memory used for item 16 is::14619104 > > Memory used for item 17 is::15137664 > > Memory used for item 18 is::15655856 > > Memory used for item 19 is::16175768 > > Memory used for item 20 is::16687440 > > Memory used for item 21 is::17192536 > > Memory used for item 22 is::17712152 > > Memory used for item 23 is::18227080 > > Memory used for item 24 is::18867536 > > Memory used for item 25 is::19372664 > > Memory used for item after all items are written and saved to file: > > 19180232 > > * > > > > Please advise if am missing something in the API which needs to be used. > > > > Thanks & Regards, > > Neelima > > > > > > -- > -Devin > --0015175defb8f0f92e04afb70b05--