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 BCBDD200D36 for ; Mon, 6 Nov 2017 14:58:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BB51A160BEC; Mon, 6 Nov 2017 13:58:04 +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 0DE081609E0 for ; Mon, 6 Nov 2017 14:58:03 +0100 (CET) Received: (qmail 3000 invoked by uid 500); 6 Nov 2017 13:58:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 2989 invoked by uid 99); 6 Nov 2017 13:58:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Nov 2017 13:58:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 3A6F918086F for ; Mon, 6 Nov 2017 13:58:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id xy78CT1Hy4lU for ; Mon, 6 Nov 2017 13:58:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 1418B60D36 for ; Mon, 6 Nov 2017 13:58:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 58FBCE0A3A for ; Mon, 6 Nov 2017 13:58:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 130EB2419F for ; Mon, 6 Nov 2017 13:58:00 +0000 (UTC) Date: Mon, 6 Nov 2017 13:58:00 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (JEXL-244) Webapp classloader memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 06 Nov 2017 13:58:04 -0000 [ https://issues.apache.org/jira/browse/JEXL-244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro updated JEXL-244: ------------------------------- Assignee: Henri Biestro > Webapp classloader memory leaks > ------------------------------- > > Key: JEXL-244 > URL: https://issues.apache.org/jira/browse/JEXL-244 > Project: Commons JEXL > Issue Type: Bug > Affects Versions: 3.1 > Environment: Inside J2EE container when Jexl library is included in the deployed .war file > Reporter: Dmitri Blinov > Assignee: Henri Biestro > > I have spotted that the following constructions, like for example in JexlEngine.java > {code} > public static final Object TRY_FAILED = new Object() { > @Override > public String toString() { > return "tryExecute failed"; > } > }; > {code} > are not garbage collected when web-app is reloaded and its classloader is released. This is because circular references are created when static class members are initialized with non-static inner/anonymous classes, which are holding implicit references to its enclosing class and thus to its static class type. There are other such examples in JexlEngine.java like > {code} > protected static final java.lang.ThreadLocal CONTEXT = new java.lang.ThreadLocal() {.. > protected static final java.lang.ThreadLocal ENGINE = > new java.lang.ThreadLocal() {... > {code} > The issue is easily resolved if for example the following pattern is followed > {code} > public static class FailObject extends Object { > @Override > public String toString() { > return "tryExecute failed"; > } > } > public static final Object TRY_FAILED = new FailObject(); > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)