#46 Memory leak on findSystemClass0

open
nobody
None
2
2010-04-13
2010-03-29
mehmet
No

Valgrind detect a memory leak on method findSystemClass0

bellow valgrind debug:

==27411== 572 bytes in 143 blocks are definitely lost in loss record 6 of 11
==27411== at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==27411== by 0x804BF76: sysMalloc (alloc.c:2269)
==27411== by 0x8051A4F: linkClass (class.c:1016)
==27411== by 0x8053507: findSystemClass0 (class.c:1421)
==27411== by 0x8053C1F: findClassFromClassLoader (class.c:1546)
==27411== by 0x806205C: resolveClass (resolve.c:112)
==27411== by 0x805324C: defineClass (class.c:552)
==27411== by 0x80533C0: loadSystemClass (class.c:1363)
==27411== by 0x8053517: findSystemClass0 (class.c:1418)
==27411== by 0x8053C1F: findClassFromClassLoader (class.c:1546)
==27411== by 0x806205C: resolveClass (resolve.c:112)
==27411== by 0x805237B: defineClass (class.c:305)
==27411== by 0x80533C0: loadSystemClass (class.c:1363)
==27411== by 0x8053517: findSystemClass0 (class.c:1418)
==27411== by 0x805399F: prepareClass (class.c:161)
==27411== by 0x8052272: defineClass (class.c:282)
==27411== by 0x80533C0: loadSystemClass (class.c:1363)
==27411== by 0x8053517: findSystemClass0 (class.c:1418)
==27411== by 0x8053FE9: initialiseClass (class.c:2018)
==27411== by 0x8067044: initVM (init.c:85)
==27411== by 0x804B4E5: main (jam.c:364)

The test programm:

public class Main
{
public static void main(String [] argv)
{
double x = 0;
double y = 0;
while (true) {
y = Math.sqrt(x);
System.out.println("\"\033[32m sqrt(" + x + ")=" + y + " \033[0m\"");
x++;
if (x >= 398029920) x = 0;
}
}
}

command :
jamvm -Xbootclasspath:JVM/classes.zip:JVM/glibj.zip -Djava.class.path=. -Djava.library.path=JVM/classpath -Dgnu.classpath.boot.library.path=JVM/classpath -Xmx8m -Xms8m Main

Test conditions are the following:
jamvm: JamVM 1.5.4
classpath: 0.98
system:: Linux desktop 2.6.28-17-generic #58-Ubuntu SMP Tue Dec 1 18:57:07 UTC 2009 i686 GNU/Linux

Discussion

  • mehmet
    mehmet
    2010-03-29

    • priority: 5 --> 9
     
  • Robert Lougher
    Robert Lougher
    2010-04-13

    572 bytes in not a major leak, so it does not justify a severity of 9. Downgrading.

     
  • Robert Lougher
    Robert Lougher
    2010-04-13

    • priority: 9 --> 2