Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4068618

Motif FontPeer needs to be disposed to prevent memory leak

    Details

    • Subcomponent:
    • Resolved In Build:
      b03
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.5.1, solaris_2.6

      Backports

        Description

        Name: rlT66838 Date: 07/30/97

        Software: Solaris 2.5.1
        Hardware: Ultra Sparc 1

        The following source core makes the Java VM grow in
        size indefinitely indicating a memory leak in the VM
        or the Solaris motif libraries.

        Here's the java source code:

        import java.awt.*;

        public class MemoryLeak7
        {
        public static void main( String args[] )
        {
        for( ;; )
        {
        for( int i = 0; i < 16; i++ )
        {
        Frame frame = new Frame();
        frame.setSize( 300, 300 );
        frame.setTitle( "Leaky Frame" );
        frame.setVisible( true );
        frame.setVisible( false );
        frame.dispose();
        frame = null;
        }
        System.gc();
        System.runFinalization();

        try
        {
        System.out.println( "---------- Sleeping ----------" );
        Thread.currentThread().sleep( 5000 );
        System.out.println( "------ Finished Sleeping ------" );
        }
        catch( Exception e )
        {
        System.err.println( "Thread interrupted" );
        }
        } // end: infinite for loop
        } // end: main
        }
        company - Sterling Diagnostic Imaging, Inc. , email - ###@###.###
        ======================================================================


        ###################### so#3383176 - Thu14May98-15:45 BELLEY ###############3
        # java -fullversion
        java full version "Solaris_JDK_1.1.5_02"

        Bug number 4068618 still occurs on a cleanly installed 128MB Ultra 5
        running 2.5.1. Per the install instructions, I installed patches 103566-25
        and 103640-17.

        I was monitoring memory usage by simply doing ls -la /proc/xxx on the pid
        of the job. Left running, this program will CRASH the machine (first, it
        reports a SYSSEGV error, and the machine is left in a state that requires a
        reboot to clear).

        The source code I was using is as follows: (slightly modified from the
        reported bug:)

        import java.awt.*;
        import java.util.*;


        public class MemoryLeak7
        {
          public static void main( String args[] )
            {
              Frame frame;
              Runtime rt = Runtime.getRuntime();
              for( ;; )
        {
        for( int i = 0; i < 16; i++ )
        {
        frame = new Frame();
        frame.setSize( 300, 300 );
        frame.setTitle( "Leaky Frame" );
        frame.setVisible( true );
        frame.setVisible( false );
        frame.dispose();
               
        }
        rt.gc();
        System.gc();
        System.runFinalization();
        rt.gc();
        try
        {
        System.out.println( "---------- Sleeping ----------" );
        Thread.currentThread().sleep( 1000 );
        System.out.println( "------ Finished Sleeping ------" );
        System.out.println("Total Memory: "+rt.freeMemory());
        }
        catch( Exception e )
        {
        System.err.println( "Thread interrupted" );
        }
        } // end: infinite for loop
            } // end: main
        }


        For what it is worth, we tried this on a system running 2.6, and the same
        problem occurs.
        ######################

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  pongsunw Patrick Ong (Inactive)
                  Reporter:
                  rlewis Roger Lewis (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: