Make every java process 20 bytes smaller (original) (raw)
Martin Buchholz martinrb at google.com
Sun Jun 14 17:08:48 UTC 2009
- Previous message: hg: jdk7/tl/langtools: 9 new changesets
- Next message: hg: jdk7/tl/jdk: 2 new changesets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Kumar,
I'd like you to do a code review and file a bug.
Synopsis: Fix small memory leak in launcher Description:
This little change to the launcher
- fixes a leak of 20 bytes in every java process
- fixes the leak of classpath wildcard expansion when that feature is used.
diff --git a/src/share/bin/java.c b/src/share/bin/java.c --- a/src/share/bin/java.c +++ b/src/share/bin/java.c @@ -683,10 +683,14 @@ SetClassPath(const char *s) { char *def;
- const char *orig = s;
- static const char format[] = "-Djava.class.path=%s"; s = JLI_WildcardExpandClasspath(s);
- def = JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(def, "-Djava.class.path=%s", s);
- def = JLI_MemAlloc(sizeof(format) - 2 + JLI_StrLen(s));
- sprintf(def, format, s); AddOption(def, NULL);
- if (s != orig)
JLI_MemFree((char *) s);
}
/*
This code is particularly prone to off-by-one bugs, but I think we can get it right.
Webrev at: http://cr.openjdk.java.net/~martin/launcher-leak/
Is Kowalski still around? He may have been the last person to touch this.
Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20090614/60a65780/attachment.html>
- Previous message: hg: jdk7/tl/langtools: 9 new changesets
- Next message: hg: jdk7/tl/jdk: 2 new changesets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]