Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 92039 invoked from network); 7 Jun 2006 15:04:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jun 2006 15:04:47 -0000 Received: (qmail 41626 invoked by uid 500); 7 Jun 2006 15:04:40 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 41599 invoked by uid 500); 7 Jun 2006 15:04:39 -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 41588 invoked by uid 99); 7 Jun 2006 15:04:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 08:04:39 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of peterlkeegan@gmail.com designates 64.233.166.181 as permitted sender) Received: from [64.233.166.181] (HELO py-out-1112.google.com) (64.233.166.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2006 08:04:37 -0700 Received: by py-out-1112.google.com with SMTP id c30so228570pyc for ; Wed, 07 Jun 2006 08:04:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=rVNj6Zxxj2L+g0xA7GMe8nEOOL3YMlq5Xd8ACQf6YNaMc1dkKXQPkHR+DfbZoJM/UYSmCGb30WpzNmKVtOmbN3QR11NMwdC8dCKQIBGYvbKh6fR2LX8SVeNa2YWn5QwcZ5JU/J2nn4nqkIQ1QvO12q6JtlPwnhO2e25wqcpgHog= Received: by 10.35.40.10 with SMTP id s10mr816724pyj; Wed, 07 Jun 2006 08:04:16 -0700 (PDT) Received: by 10.35.60.14 with HTTP; Wed, 7 Jun 2006 08:04:16 -0700 (PDT) Message-ID: Date: Wed, 7 Jun 2006 11:04:16 -0400 From: "Peter Keegan" To: java-user@lucene.apache.org Subject: Re: MMapDirectory vs RAMDirectory In-Reply-To: <4484C6DC.9020009@nuix.com.au> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4436_26692321.1149692656696" References: <429c032d0605280109i7f0c8392x6d0017a5f6b70aac@mail.gmail.com> <20060528082805.97131.qmail@web25915.mail.ukl.yahoo.com> <4484C6DC.9020009@nuix.com.au> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_4436_26692321.1149692656696 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I was able to improve the behavior by setting the mapped ByteBuffer to null in the close method of MMapIndexInput. This seems to be a strong enough 'suggestion' to the gc, as I can see the references go away with process explorer, and the index files can be deleted, usually. Occasionally, a reference to the '.tis' file remains. Peter On 6/5/06, Daniel Noll wrote: > > Peter Keegan wrote: > > > There is no 'unmap' method, so my understanding is that the file mapping > is > > valid until the underlying buffer is garbage-collected. However, forcing > > the gc doesn't help. > > You're half right. > > The file mapping is indeed valid until the underlying buffer is garbage > collected, but you can't "force" the GC -- there is no API which does > that. > > Note the wording in the Javadoc for System.gc(): > > "Calling the gc method **suggests** that the Java Virtual Machine > expend effort toward recycling unused objects in order to make the > memory they currently occupy available for quick reuse. When control > returns from the method call, the Java Virtual Machine has made a > best effort to reclaim space from all discarded objects." > > > The file deletes don't fail on Linux, but I'm wondering if there is > still a > > memory leak? > > Linux allows you to delete a file while someone has the file descriptor > open, but the file descriptor will remain valid (i.e. the delete doesn't > actually occur) until everyone releases the file descriptor. > > I ran into similar issues as these when working on other things, and > eventually ended up switching to using a RandomAccessFile, as those can > be closed. Otherwise you're right -- the workaround is to routinely try > to delete the file. > > Daniel > > -- > Daniel Noll > > Nuix Pty Ltd > Suite 79, 89 Jones St, Ultimo NSW 2007, Australia Ph: +61 2 9280 0699 > Web: http://www.nuix.com.au/ Fax: +61 2 9212 6902 > > This message is intended only for the named recipient. If you are not > the intended recipient you are notified that disclosing, copying, > distributing or taking any action in reliance on the contents of this > message or attachment is strictly prohibited. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ------=_Part_4436_26692321.1149692656696--