You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/11/07 07:45:50 UTC

[Bug 57619] Memory consumption

https://bz.apache.org/bugzilla/show_bug.cgi?id=57619

Dmitri Blinov <dm...@mail.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WONTFIX                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Dmitri Blinov <dm...@mail.ru> ---
I have found the similar simptoms that the multiple "jar" strings are allocated
by tomcat WebappClassLoader. The problem stems from usage of
java.net.URL(String spec) constructor for ResourceEntry. The
java.net.URL(String) parses the source and splits the "scheme" part, and by
forcibly converting it toLowerString a separate copy of "jar" string is created
for each new ResourceEntry. The problem can be solved by using different
java.net.URL(String protocol, String host, int port, String file) constructor,
where "jar" can by passed as a constant which could be shared by all instances
of created URL classes. 

I have created a small home test for Tomcat 7.0.82, which by means of
visualvm/heapdump showed that "jar" strings are realy shared among different
instances of URLs.

The code for example for Tomcat 7.0.82 is located in
org.apache.tomcat.buf.UriUtil.java, the commented lines are from previous
version:

    public static URL buildJarUrl(String fileUrlString, String entryPath)
throws MalformedURLException {
        String safeString = makeSafeForJarUrl(fileUrlString);
        StringBuilder sb = new StringBuilder();
        // sb.append("jar:");
        sb.append(safeString);
        sb.append("!/");
        if (entryPath != null) {
            sb.append(makeSafeForJarUrl(entryPath));
        }
        // return new URL(sb.toString());
        return new URL("jar", null, -1, sb.toString());
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org