← Back to team overview

openjdk team mailing list archive

[Bug 1034958] [NEW] Java memory leak running jni through swig

 

Public bug reported:

I installed swig2.0 and swig2.0-examples and then modified the examples
in 2 ways.  First I unzipped swig2.0-examples/Makefile.gz and edited the
JAVA_INCLUDE line to be

JAVA_INCLUDE= -I"/usr/lib/jvm/java-7-openjdk-amd64/include"
-I"/usr/lib/jvm/java-7-openjdk-amd64/include/linux"

Then I edited the file swig2.0-examples/java/class/runme.java to add the
following to the main() procedure.

  public static void main(String argv[])
  {
    // ----- Object creation -----                                              

      for (int i = 0; i < 10000; i++)
          {

              for (int j = 0; j < 10000; j++)
                  {
                      System.out.println( "    Loop number " + i + ","+j );
                      for (int k = 0; k < 10000; k++)
                          {
                              Circle c = new Circle(10);
                              c.delete();
                          }
                  }
          }


When I run I see the memory usage for the process increase until it hits around 25% of total memory.  Then the process starts running very slowly (I think it is trying to find free memory).  Finally it crashes with the error:

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
        at runme.main(runme.java:26)

Interestingly, this error does not occur on a different system which
also has Ubuntu 12.04 and openjdk-7-jre but which is a 32-bit i386
architecture.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: openjdk-7-jre-headless 7~u3-2.1.1~pre1-1ubuntu3
ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
Uname: Linux 3.2.0-23-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.0.1-0ubuntu12
Architecture: amd64
Date: Thu Aug  9 11:17:30 2012
ExecutablePath: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
LocalLibraries: /home/nks/swig2.0-examples/java/class/libexample.so
ProcEnviron:
 SHELL=/bin/bash
 TERM=dumb
 PATH=(custom, user)
 LANG=en_US.UTF-8
SourcePackage: openjdk-7
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: openjdk-7 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug local-libs precise

-- 
You received this bug notification because you are a member of OpenJDK,
which is subscribed to openjdk-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1034958

Title:
  Java memory leak running jni through swig

Status in “openjdk-7” package in Ubuntu:
  New

Bug description:
  I installed swig2.0 and swig2.0-examples and then modified the
  examples in 2 ways.  First I unzipped swig2.0-examples/Makefile.gz and
  edited the JAVA_INCLUDE line to be

  JAVA_INCLUDE= -I"/usr/lib/jvm/java-7-openjdk-amd64/include"
  -I"/usr/lib/jvm/java-7-openjdk-amd64/include/linux"

  Then I edited the file swig2.0-examples/java/class/runme.java to add
  the following to the main() procedure.

    public static void main(String argv[])
    {
      // ----- Object creation -----                                              

        for (int i = 0; i < 10000; i++)
            {

                for (int j = 0; j < 10000; j++)
                    {
                        System.out.println( "    Loop number " + i + ","+j );
                        for (int k = 0; k < 10000; k++)
                            {
                                Circle c = new Circle(10);
                                c.delete();
                            }
                    }
            }

  
  When I run I see the memory usage for the process increase until it hits around 25% of total memory.  Then the process starts running very slowly (I think it is trying to find free memory).  Finally it crashes with the error:

  Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
          at runme.main(runme.java:26)

  Interestingly, this error does not occur on a different system which
  also has Ubuntu 12.04 and openjdk-7-jre but which is a 32-bit i386
  architecture.

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: openjdk-7-jre-headless 7~u3-2.1.1~pre1-1ubuntu3
  ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
  Uname: Linux 3.2.0-23-generic x86_64
  NonfreeKernelModules: nvidia
  ApportVersion: 2.0.1-0ubuntu12
  Architecture: amd64
  Date: Thu Aug  9 11:17:30 2012
  ExecutablePath: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
  InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
  LocalLibraries: /home/nks/swig2.0-examples/java/class/libexample.so
  ProcEnviron:
   SHELL=/bin/bash
   TERM=dumb
   PATH=(custom, user)
   LANG=en_US.UTF-8
  SourcePackage: openjdk-7
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/1034958/+subscriptions


Follow ups

References