Return-Path: Delivered-To: apmail-incubator-pig-dev-archive@locus.apache.org Received: (qmail 15023 invoked from network); 12 Dec 2007 23:32:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2007 23:32:05 -0000 Received: (qmail 49065 invoked by uid 500); 12 Dec 2007 23:31:54 -0000 Delivered-To: apmail-incubator-pig-dev-archive@incubator.apache.org Received: (qmail 49007 invoked by uid 500); 12 Dec 2007 23:31:53 -0000 Mailing-List: contact pig-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pig-dev@incubator.apache.org Delivered-To: mailing list pig-dev@incubator.apache.org Received: (qmail 48998 invoked by uid 99); 12 Dec 2007 23:31:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 15:31:53 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 23:31:40 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A1D20714236 for ; Wed, 12 Dec 2007 15:31:43 -0800 (PST) Message-ID: <2772009.1197502303660.JavaMail.jira@brutus> Date: Wed, 12 Dec 2007 15:31:43 -0800 (PST) From: "Benjamin Reed (JIRA)" To: pig-dev@incubator.apache.org Subject: [jira] Commented: (PIG-40) Memory management in BigDataBag is probably wrong In-Reply-To: <4009847.1196381503814.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PIG-40?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551159 ] Benjamin Reed commented on PIG-40: ---------------------------------- How about class MemoryManager { static MemoryManager getMemoryManager(); void add(Spillable spillable); } add() will put Spillable on a WeakList so that the Spillable object will get GCed when strong references go away. > Memory management in BigDataBag is probably wrong > ------------------------------------------------- > > Key: PIG-40 > URL: https://issues.apache.org/jira/browse/PIG-40 > Project: Pig > Issue Type: Bug > Components: impl > Reporter: Sam Pullara > Assignee: Benjamin Reed > Attachments: BigDataBag.java, MemoryUsage.java > > > src/org/apache/pig/data/BigDataBag.java > 1) You should not use finalizers for things other than external resources -- using them here is very dangerous and could inadvertantly lead to deadlocks and object resurrection and just decreases performance without any advantage. > 2) Using .freeMemory() the way it is used in this class is broken. freeMemory() is going to return a mostly random number between 0 and the real amount. Adding gc() in here is a terrible performance burden. If you really want to do something like this you should using softreferences and finalization queues. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.