Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7A98D200ACB for ; Sun, 29 May 2016 09:26:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 798A9160A07; Sun, 29 May 2016 07:26:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C33B41609AD for ; Sun, 29 May 2016 09:26:33 +0200 (CEST) Received: (qmail 6826 invoked by uid 500); 29 May 2016 07:26:33 -0000 Mailing-List: contact dev-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list dev@groovy.apache.org Received: (qmail 6815 invoked by uid 99); 29 May 2016 07:26:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 May 2016 07:26:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 37394C0D9E for ; Sun, 29 May 2016 07:26:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.701 X-Spam-Level: X-Spam-Status: No, score=-0.701 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZWj2taSWbMca for ; Sun, 29 May 2016 07:26:31 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 623CF5F257 for ; Sun, 29 May 2016 07:26:30 +0000 (UTC) Received: from [192.168.1.3] ([92.224.29.172]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MVvB2-1b0Okn2qNc-00X6sK for ; Sun, 29 May 2016 09:26:21 +0200 Subject: Re: Improve Groovy class loading performance and memory management To: dev@groovy.apache.org References: <5749AFEA.80303@span.ch> <5749D21E.8050101@span.ch> <5749D7AA.1020707@span.ch> <5749E4A9.2050600@span.ch> <574A8FB2.3010402@span.ch> From: Jochen Theodorou Message-ID: <574A999A.3090900@gmx.org> Date: Sun, 29 May 2016 09:26:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <574A8FB2.3010402@span.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:R3+rgl1ApNkVceK3azaVP8ETogy38sP/rswAqpQvW4/oM7ppbRa nTmBJaI/Lq3XoSyy/WZrU1Z9OKMP7HfDZ3uSaW3b9jB4Jr6cymsAvNYfDHr3n2KHjCLUbXK zEn+etKvo2d2U66beb/O37LLyoQApQe2sizXp7mr4lVuXZ+SHUeyl5sN+qHfujyULTv7Iup w9Mo3I0/o15JuATvziIWg== X-UI-Out-Filterresults: notjunk:1;V01:K0:tR3JEtqxcrg=:Iqde8sRIuNe3LghXBcBkLO Dm7tY1SxWZELFVWZGkAzwxrXrvmWtviF5n0l1eq+J5UcKm/BdaRqR4NcrbfiNwW7ZYwNy6IAH o5oMwsx6LmAc94+lpqUKlHFY8KRLMalUxy9L3wOEf5n/4+YX7HgiGmVwqs83vpWlCMyuCoYfP FLXdCTdxwfYKigi3eZ0i4Z+FTKmPgtvL0DitjRMexeNeVJ9uZYzaV3rSjRv4nJYN3DeV799Xc oSpH0yDxJuijs855k8agKKYIV9WwuTb9dhxolb3cKdLg2a9XfAn3OQf3x9XFmMWxFp+5FNIbK 4wlp5UzwYu1KVYLZH/Cr/6Ek0wxccKxtyuOH2rfKucdWkHTJd7YMkQI37rfHWaLitrrnwGsKg JcjUySx26N0l167BbogQKIJbZHq8Ondqpsw7n3RTtrlmImXNDOligp2tPTexhBqFn81Yu9mRP NVaK58ebNhus3jaAHtCOnDOIIn4kDXVjluZeSQyqHp6oqjVSXyA/xGGiwliYpEtPnwBT1AtbS vSu5EttAhefOG3Py0oftAkO3KEgrDb4vLYSHAaU9CRZ51MVi++ozuhqxezkI8EgA2sfd8PQ+8 2IwtRAsvsKGykegK7H827sKsqVArLUUyjLn/shlJb48UyNoUFrP54K8rdZluO+QOjSa5Q1l0G outTUUvDz9a9eAii7k1+ML2uTy/t4lEYqN/+09wwx55XoBBcDWKv4F+prNEre2JI7vj832tE0 CKGEKrzG+Wo1+lAlsYCyzioH5StUtRkRGzjjceNUeUtj4rWexxJQZVZfKnt6TNhth7NQmuhY3 PsoHYJ4 archived-at: Sun, 29 May 2016 07:26:34 -0000 On 29.05.2016 08:44, Alain Stalder wrote: [...] > If I use a WeakHashMap or Collections.synchronizedMap(WeakHashMap) > instead of the map from the Spring Framework, classes are not > collectable in the script-running-use-case (OutOfMemoryError) unless I > replace klazz in ClassInfo with a WeakRefererence and then it becomes > (only) softly-collectable. which is no wonder if the value strongly references the key > All in all, I think this means that universally weakly-collectable > Groovy classes are more of a dream at the moment, at least before a > Groovy 3, and the merge requests for GROOVY-7683 (weak reference to > Class in ClassInfo) and GROOVY-7646 (explicit cleanup after running > scripts in GroovyShell) seem to be the best that can be done at the moment? at least the weak reference to Class in ClassInfo is something I think we can do without too much danger. Of course we may have to handle the case in which a ClassInfo still exists, but the class is collected... As for the introspector. My suggestion would be to clean the introspector of the specific class at the end of MetaclassImpl#addProperties > PS: Just for fun, I wrote a version where the map from the Spring > Framework is using soft references for > java.*/javax.*/groovy.*/org.codehaus.groovy.* classes and weak > references for all others, and that passed all my test scripts. yeah.... I think, that's not good enough for us. You can have extension methods to ther classes, so it is no good if these get collected without recovery for the extension methods bye Jochen