New! View global litigation for patent families

WO2001031455A1 - A method for garbage collection of unused methods - Google Patents

A method for garbage collection of unused methods

Info

Publication number
WO2001031455A1
WO2001031455A1 PCT/SE2000/002096 SE0002096W WO2001031455A1 WO 2001031455 A1 WO2001031455 A1 WO 2001031455A1 SE 0002096 W SE0002096 W SE 0002096W WO 2001031455 A1 WO2001031455 A1 WO 2001031455A1
Authority
WO
Grant status
Application
Patent type
Prior art keywords
methods
program
method
regenerated
used
Prior art date
Application number
PCT/SE2000/002096
Other languages
French (fr)
Inventor
Joakim Dahlstedt
Original Assignee
Appeal Virtual Machines Ab
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRICAL DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99951File or database maintenance
    • Y10S707/99956File allocation
    • Y10S707/99957Garbage collection

Abstract

A method for improving the effectiveness of a data processing application when using a virtual machine, wherein the program includes a large number of methods, i.e. program sections, that are stored in the memory of the computer used, and wherein the program uses a garbage collecting procedure. The invention is characterised by analysing in a first step all so called thread stacks with respect to the procedures required thereby; causing each of said requisite methods to be regenerated in a second step, wherein occurring references to a method prior to the regeneration are replaced with references to regenerated methods; and by erasing all non-regenerated methods in a third step and placing corresponding memory space at the disposal of the program.

Description

A METHOD FOR GARBAGE COLLECTION OF UNUSED METHODS

The present invention relates to a method of improving the effectiveness of a data processing application.

More specifically, the invention is concerned with increasing the data processing rate in virtual machines, and then particularly with respect to the Java program language.

The invention is not restricted to Java, but can be applied with many program languages, although the invention is described below primarily with reference to Java.

The method is intended for use with adaptive optimisation of a program. In adaptive optimisation, the program is restructured and different parts of the program are optimised as the program is run. The general problem of increasing data processing capacity resides in the rapid creation of new memory sites, since the longer the program is run, the more memory space is required.

Java and other dynamic program languages include an automatic memory management. This means that the programmer need not keep an account of those parts of the memory that are used. The virtual machine carries out a so-called garbage collection from time to time, meaning, in principle, that the virtual machine scans the entire memory and finds which objects have been stored in the memory and which the program can no longer address. These parts of the memory are returned for later use.

Java also includes methods for so called thread management methods. Thus, Java incorporates a system for supporting or simulating the simultaneous processing of two or more programs. The thread management can be divided into two parts. One part concerns the manner in which different threads are structured in a controlled manner. Another part is concerned with which threads shall be run and which threads shall be passive and wait to be run. In order to further increase effectiveness and place occupied memory space at the disposal of the program, it is not sufficient to solely optimise the memory with respect to the objects.

The present invention solves this problem.

The present invention thus relates to a method of improving the effectiveness of a data processing application when using a virtual machine, where the program includes many methods, i.e. program sections, that are stored in the memory of the computer used, and where garbage collecting is used by said program, wherein the inventive method is characterised by a first step in which all so-called thread stacks are analysed with respect to methods required thereby; a second step in which each of the methods required is caused to be regenerated where occurrent references to a method are replaced with reference to regenerated methods prior to the regeneration of a method; and by a third step in which all non-regenerated methods are erased, wherein the corresponding memory space is placed at the disposal of said program.

The present invention will now be described in more detail partly with reference to an exemplifying embodiment of the invention shown on to the accompanying drawing, in which

- Figure 1 is a block diagram;

- Figure 2 illustrates old methods; and

- Figure 3 illustrates methods regenerated in accordance with the invention.

Figure 1 shows that a Java virtual machine, JVM, can be used to run different data programs 1, 2, 3, regardless of whether the operative system is WinNT, LINUX, Solaris or some other system. As mentioned above, although Java is a very popular program language, the present invention is not restricted to this language but can be applied to all object-orientated and platform-independent corresponding program languages.

The present invention thus relates to a method of improving the effectiveness of a data processing application when using a virtual machine, wherein the program includes a large number of methods, i.e. program sections, that are stored in the memory of the computer used, and wherein a garbage collecting process is used by the program. It is previously known to garbage collect objects and therewith erase objects that are no longer in current use thereby placing corresponding memory capacity at disposal.

In large systems, many methods, i.e. program sections, are used one or a few times, or methods are applied for a short period of time and then left unused.

In the case of Java and corresponding programs, new methods are loaded and old methods left unused.

Furthermore, adaptive optimisation results in the optimisation and re-optimisation of methods placed in the memory, where old methods are left unused.

When optimising lock mechanism selection and garbage collection selection, it is necessary to replace all used methods that use old mechanisms with new mechanisms.

According to the invention, all so called thread stacks are analysed with respect to the methods required, in a first step of the inventive method. In a second step, each of the methods required is regenerated, where occurrent references to a method are replaced with references to regenerated methods prior to said regeneration. In a third step, all non- regenerated methods are erased and the corresponding memory space placed at the disposal of the program.

This procedure does not only clean-out unused methods, but also results in a reorganisation between those methods that have been regenerated, so as to direct references of the methods immediately to a regenerated method instead of proceeding via an old method that is no longer used.

This is illustrated in Figures 2 and 3, of which Figure 2 illustrates old methods and Figure 3 illustrates used regenerated methods. Three methods foo, apa and bar are shown in

Figure 2. Foo starts on the memory address 4711. Apa starts on the address 4714 and bar starts on the address 4720. Analysis of the thread stacks shows that only the methods foo and bar are used, and consequently foo and bar have not been referenced to the method apa.

The method foo and bar are regenerated to those methods illustrated in Figure 3. In this case, the methods foo and bar are recreated precisely, although with the difference that the methods obtain new addresses and that then the foo reference to bar points to the new bar address 4903.

All old methods, i.e. the methods in Figure 2, are erased and the memory spaces previously occupied by these methods are vacated for further use.

When garbage collection of objects takes place, running of the program normally stops while garbage collection takes place. Running of the program is restarted subsequent to the garbage collection and to the erasure of objects that are not in use.

Such a method can be used when applying the present invention.

However, it is very much preferred to use the following method instead.

When practicing the inventive method, one thread is stopped at a time whilst the program is running, wherewith methods used for a stopped thread are transferred to a list and the thread then restarted. The methods in the list are then regenerated and stored. All threads are later caused to be stopped at the same time, subsequent to having treated all threads in this way, namely so that all used methods relating to the threads concerned have been regenerated. All methods that have not been regenerated are erased and all threads are restarted with the regenerated methods.

This method obviates the need to stop running the program, since the regeneration takes place intermittently.

As before mentioned, lock mechanisms are used in Java and corresponding languages. Different lock mechanisms can be selected. The important thing is to select the lock mechanism that is the most effective in preventing more than one thread having access to a given object at the same time as another thread. A synchronisation problem exists when several threads desire access to one and the same object or source. In order to solve this problem in Java, each thread endeavours to reach the source lock. The source lock mechanism can be used in various ways. The effectiveness of different lock mechanisms will depend on how threads endeavour to obtain access to synchronised sources.

According to a preferred embodiment, when locking mechanisms are used the most effective locking mechanisms are identified in a step prior to said first step, and the methods that use a thus identified locking mechanism are regenerated.

With respect to garbage collecting algorithms, these also need to be selected. Many object orientated languages use garbage collection. This means that the programmer need not instruct the system explicitly that a certain object is no longer required. The system is responsible for this detection, and reclaims the part of the memory occupied by the object.

A number of different algorithms have been proposed for effective implementation of this detection and reclaim. It has been found that different algorithms are best for different applications. The choice of the best garbage collecting algorithm for the program application being run is highly significant in achieving maximum execution rate in respect of the program concerned.

According to another preferred embodiment of the invention, when different garbage collecting algorithms are used the allocation and length of life of the various objects are determined in a step prior to said first method step, whereafter the most effective garbage collecting algorithm is caused to be identified and the methods constituting the requisite garbage collecting algorithms are regenerated and remaining garbage collecting algorithms then erased.

Application of the preferred embodiments provides a highly effective method for optimising codes, threads and memory management, where a generic feature resides in the identification and regeneration of methods so as to not load the system with unused methods.

Claims

1. A method for improving the effectiveness of a data processing application when using a virtual machine, wherein the program includes a large number of methods, i.e. program sections, that are stored in the memory of the computer used, and wherein the program uses a garbage collecting procedure, characterised by analysing in a first step all so called thread stacks with respect to the methods required thereby; causing each of said requisite methods to be regenerated in a second step, wherein occurring references to a method prior to regeneration are replaced with references to regenerated methods; and by erasing all non-regenerated methods in a third step and placing corresponding memory space at the disposal of the program.
2. A method according to Claim 1, characterised by causing one thread at a time to be stopped as the program is run; transferring methods used for a stopped thread to a list, and thereafter restarting the thread; regenerating and storing the methods in said list; causing all threads to be stopped simultaneously subsequent to having treated all threads in said fashion; erasing all methods that have not been regenerated and restarting all threads with the regenerated methods.
3. A method according to Claim 1 or 2, characterised by, when locking mechanisms are used, identifying the most effective locking mechanism in a step prior to said first method step; and regenerating those methods that use a thus identified locking mechanism.
4. A method according to Claim 1, 2 or 3, characterised by, when different garbage collecting algorithms are used, determining the allocation and length of life of the various objects in a step prior to said first method step, and then identifying the most effective garbage collecting algorithm; regenerating the methods constituting the requisite garbage collecting algorithms; and erasing remaining garbage collecting algorithms.
PCT/SE2000/002096 1999-10-28 2000-10-27 A method for garbage collection of unused methods WO2001031455A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
SE9903890 1999-10-28
SE9903890-3 1999-10-28

Applications Claiming Priority (8)

Application Number Priority Date Filing Date Title
JP2001533523A JP4150518B2 (en) 1999-10-28 2000-10-27 The method for collecting unnecessary data program section unused
DE2000639628 DE60039628D1 (en) 1999-10-28 2000-10-27 The procedure method of heap collection of unused
EP20000978146 EP1240589B1 (en) 1999-10-28 2000-10-27 A method for garbage collection of unused methods
CA 2389168 CA2389168C (en) 1999-10-28 2000-10-27 A method for garbage collection of unused methods
US10111566 US7194494B1 (en) 1999-10-28 2000-10-27 Method for garbage collection of unused methods
US10162308 US6970893B2 (en) 2000-10-27 2002-06-04 System and method for regeneration of methods and garbage collection of unused methods
US11187529 US7650370B2 (en) 1999-10-28 2005-07-22 System and method for regeneration of methods and garbage collection of unused methods
US11586192 US20070073794A1 (en) 1999-10-28 2006-10-25 Method for garbage collection of unused methods

Related Child Applications (2)

Application Number Title Priority Date Filing Date
US11156602 A-371-Of-International 2002-04-26 2002-04-26
US10162308 Continuation-In-Part US6970893B2 (en) 1999-10-28 2002-06-04 System and method for regeneration of methods and garbage collection of unused methods

Publications (1)

Publication Number Publication Date
WO2001031455A1 true true WO2001031455A1 (en) 2001-05-03

Family

ID=20417516

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/SE2000/002096 WO2001031455A1 (en) 1999-10-28 2000-10-27 A method for garbage collection of unused methods

Country Status (7)

Country Link
US (2) US7194494B1 (en)
EP (1) EP1240589B1 (en)
JP (1) JP4150518B2 (en)
CN (1) CN100382047C (en)
CA (1) CA2389168C (en)
DE (1) DE60039628D1 (en)
WO (1) WO2001031455A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010737B2 (en) 2007-06-08 2011-08-30 Robert Bosch Gmbh Method and device for reorganizing data in a memory system, in particular for control devices in motor vehicles

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005018425A (en) * 2003-06-26 2005-01-20 Matsushita Electric Ind Co Ltd Program conversion method, program and storage medium
US7395285B2 (en) 2003-06-30 2008-07-01 Matsushita Electric Industrial Co., Ltd. Garbage collection system
EP1622009A1 (en) * 2004-07-27 2006-02-01 Texas Instruments Incorporated JSM architecture and systems
CA2700217C (en) * 2010-04-01 2011-07-19 Ibm Canada Limited - Ibm Canada Limitee Write barrier elision for reference arrays

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5088036A (en) * 1989-01-17 1992-02-11 Digital Equipment Corporation Real time, concurrent garbage collection system and method
US5915255A (en) * 1997-04-23 1999-06-22 Sun Microsystems, Inc. Method and apparatus for referencing nodes using links
WO1999032978A1 (en) * 1997-12-19 1999-07-01 Microsoft Corporation Incremental garbage collection

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5355483A (en) * 1991-07-18 1994-10-11 Next Computers Asynchronous garbage collection
DE69332696D1 (en) * 1992-06-15 2003-03-27 Microsoft Corp Computer method and system for storage management
US5692193A (en) * 1994-03-31 1997-11-25 Nec Research Institute, Inc. Software architecture for control of highly parallel computer systems
US6463581B1 (en) * 1996-10-03 2002-10-08 International Business Machines Corporation Method for determining reachable methods in object-oriented applications that use class libraries
US6041179A (en) * 1996-10-03 2000-03-21 International Business Machines Corporation Object oriented dispatch optimization
US6654951B1 (en) * 1998-12-14 2003-11-25 International Business Machines Corporation Removal of unreachable methods in object-oriented applications based on program interface analysis

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5088036A (en) * 1989-01-17 1992-02-11 Digital Equipment Corporation Real time, concurrent garbage collection system and method
US5915255A (en) * 1997-04-23 1999-06-22 Sun Microsystems, Inc. Method and apparatus for referencing nodes using links
WO1999032978A1 (en) * 1997-12-19 1999-07-01 Microsoft Corporation Incremental garbage collection

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010737B2 (en) 2007-06-08 2011-08-30 Robert Bosch Gmbh Method and device for reorganizing data in a memory system, in particular for control devices in motor vehicles

Also Published As

Publication number Publication date Type
CA2389168A1 (en) 2001-05-03 application
US7194494B1 (en) 2007-03-20 grant
DE60039628D1 (en) 2008-09-04 grant
JP2003513356A (en) 2003-04-08 application
EP1240589B1 (en) 2008-07-23 grant
CN1402847A (en) 2003-03-12 application
US20070073794A1 (en) 2007-03-29 application
EP1240589A1 (en) 2002-09-18 application
JP4150518B2 (en) 2008-09-17 grant
CN100382047C (en) 2008-04-16 grant
CA2389168C (en) 2009-10-06 grant

Similar Documents

Publication Publication Date Title
US6910213B1 (en) Program control apparatus and method and apparatus for memory allocation ensuring execution of a process exclusively and ensuring real time operation, without locking computer system
US7069279B1 (en) Timely finalization of system resources
US6839823B1 (en) Increased reliability of data stored on flash memory in applications sensitive to power-loss
US6115782A (en) Method and apparatus for locating nodes in a carded heap using a card marking structure and a node advance value
US5353425A (en) Methods and apparatus for implementing a pseudo-LRU cache memory replacement scheme with a locking feature
US5909579A (en) Method and apparatus for encoding and decoding delta encoded information to locate live pointers in program data stacks
US5915255A (en) Method and apparatus for referencing nodes using links
US5900001A (en) Method and apparatus for optimizing exact garbage collection using a bifurcated data structure
US4758944A (en) Method for managing virtual memory to separate active and stable memory blocks
Cheng et al. Generational stack collection and profile-driven pretenuring
US5321834A (en) Method and system for reclaiming unreferenced computer memory space
US5903900A (en) Method and apparatus for optimizing exact garbage collection of array nodes in a carded heap
US6105040A (en) Method and apparatus for managing stored objects
Flood et al. Parallel Garbage Collection for Shared Memory Multiprocessors.
US6049810A (en) Method and apparatus for implementing a write barrier of a garbage collected heap
US4660130A (en) Method for managing virtual memory to separate active and stable memory blocks
US6694346B1 (en) Long running, reusable, extendible, virtual machine
US7089272B1 (en) Specializing write-barriers for objects in a garbage collected heap
US6817011B1 (en) Memory allocation profiling to discover high frequency allocators
US5581697A (en) Method and apparatus for run-time error checking using dynamic patching
US5920876A (en) Performing exact garbage collection using bitmaps that identify pointer values within objects
US6480862B1 (en) Relation-based ordering of objects in an object heap
US5911144A (en) Method and apparatus for optimizing the assignment of hash values to nodes residing in a garbage collected heap
US5842016A (en) Thread synchronization in a garbage-collected system using execution barriers
US20050149589A1 (en) Garbage collector with eager read barrier

Legal Events

Date Code Title Description
AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): GH GM KE LS MW MZ SD SL SZ TZ UG ZW AM AZ BY KG KZ MD RU TJ TM AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE BF BJ CF CG CI CM GA GN GW ML MR NE SN TD TG

AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BY BZ CA CH CN CR CU CZ DE DK DM DZ EE ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NO NZ PL PT RO RU SD SE SG SI SK SL TJ TM TR TT TZ UA UG US UZ VN YU ZA ZW

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
WWE Wipo information: entry into national phase

Ref document number: 2389168

Country of ref document: CA

WWE Wipo information: entry into national phase

Ref document number: 1020027005468

Country of ref document: KR

ENP Entry into the national phase in:

Ref country code: JP

Ref document number: 2001 533523

Kind code of ref document: A

Format of ref document f/p: F

WWE Wipo information: entry into national phase

Ref document number: 15632/01

Country of ref document: AU

WWE Wipo information: entry into national phase

Ref document number: 2000978146

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 008164169

Country of ref document: CN

WWP Wipo information: published in national office

Ref document number: 1020027005468

Country of ref document: KR

WWP Wipo information: published in national office

Ref document number: 2000978146

Country of ref document: EP

REG Reference to national code

Ref country code: DE

Ref legal event code: 8642

WWG Wipo information: grant in national office

Ref document number: 15632/01

Country of ref document: AU