Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 23061 invoked from network); 13 Jun 2005 14:16:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jun 2005 14:16:37 -0000 Received: (qmail 460 invoked by uid 500); 13 Jun 2005 14:16:30 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 436 invoked by uid 500); 13 Jun 2005 14:16:30 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 422 invoked by uid 99); 13 Jun 2005 14:16:30 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mx1.idowa.net (HELO mx1.idowa.net) (217.7.81.164) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 13 Jun 2005 07:16:29 -0700 Received: from mx1.idowa.net (localhost [127.0.0.1]) by mx1-int.idowa.de (Postfix) with ESMTP id C2AF5101510 for ; Mon, 13 Jun 2005 15:17:22 +0200 (CEST) Received: from mail0.vn.idowa.de (vl-gw-float.sr.idowa.net [217.7.81.140]) by mx1-sa.idowa.net (Postfix) with ESMTP id B31541014F8 for ; Mon, 13 Jun 2005 15:17:22 +0200 (CEST) Received: from [192.168.31.5] (unknown [192.168.31.5]) by mail0.vn.idowa.de (Postfix) with ESMTP id A92C845C02 for ; Mon, 13 Jun 2005 15:17:22 +0200 (CEST) Message-ID: <42AD8734.9070205@idowa.de> Date: Mon, 13 Jun 2005 15:16:36 +0200 From: Harald Stowasser User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7.2) Gecko/20040803 X-Accept-Language: de, en-us, en MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: OutOfMemory when indexing References: <42AD7F8F.5070205@sirma.bg> In-Reply-To: <42AD7F8F.5070205@sirma.bg> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig2B14CF68AD60B3A86BEFEE80" X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on hermes.idowa.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.0.0 X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------enig2B14CF68AD60B3A86BEFEE80 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Stanislav Jordanov schrieb: > High guys, > Building some huge index (about 500,000 docs totaling to 10megs of plain > text) we've run into the following problem: > Most of the time the IndexWriter process consumes a fairly small amount > of memory (about 32 megs). > However, as the index size grows, the memory usage sporadically bursts > to levels of (say) 1000 gigs and then falls back to its level. > The problem is that unless te process is started with some option like > -Xmx1000m this situation causes an OutOfMemoryException which terminates > the indexing process. > > My question is - is there a way to avoid it? 1. I start my programm with: java -Xms256M -Xmx512M -jar Suchmaschine.jar & This protect me now from OutOfMemoryException. After I use iterative-subroutines. 2. Free your variables as soon as possible. like "term=null;" This will help your Garbage-Collector! 3. Maybe you should watch totalMemory and R.freeMemory() from Runtime.getRuntime() That will help you to find the "Memory-dissipater" 4. I had the problem when deleting Documents from Index. I used a Subroutine to delete single Documents. It runs much better when I replaced it into a "iterative" subroutine like this: public int deleteMany(String keywords) { int anzahl=0; try { openReader(); String[] temp = keywords.split(","); //Runtime R = Runtime.getRuntime(); for (int i = 0 ; i < temp.length ; i++) { Term term =new Term("keyword",temp[i]); anzahl+= mReader.delete(term); term=null; /*System.out.println("deleted " + temp[i] +" t:"+R.totalMemory() +" f:"+R.freeMemory() +" m"+R.maxMemory()); */ } close(); } catch (Exception e){ cIdowa.error( "Could not delete Documents:" + keywords +". Because:"+ e.getMessage() + "\n" +e.toString() ); } return anzahl; } --------------enig2B14CF68AD60B3A86BEFEE80 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFCrYc4d2ByLviqWmYRAvHcAJ4rJZBZ28nchkB9U5fCpm+Fp5bNgQCcDmlK +B0jZ52nRIw3wy5Fl9NP0IA= =jnmG -----END PGP SIGNATURE----- --------------enig2B14CF68AD60B3A86BEFEE80--