Two-pass sliding compaction for heap memory fragmentation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing memory management systems face challenges in efficiently compacting the heap to prevent fragmentation, especially in multiprocessor environments, where sliding compaction techniques struggle to update object references without overwriting reachable objects before they are relocated.

Innovation Solution

The two-pass sliding compaction method logically divides the heap into fixed-sized segments, saving per-chunk metadata and object extent information during the marking phase to decouple the updating of object references from the relocation process, allowing for parallel processing and maintaining the address order of objects.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If sliding compaction is used to compact the heap, then memory fragmentation is reduced and allocation efficiency is improved, but in multiprocessor environments reachable objects may be overwritten before relocation causing memory corruption

Engineering Contradiction:
Improvememory safetyVSAvoidcompaction efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies preliminary action by performing a marking phase before the sliding phase, where all reachable objects are identified and marked during the first pass. This ensures that during the second pass when objects are relocated, the system has advance knowledge of which objects are reachable and must be preserved, preventing overwriting of live objects while maintaining compaction efficiency

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces an intermediary mechanism in the form of a marking bit or flag associated with each object. This intermediary marker distinguishes reachable objects from unreachable ones during the compaction process, allowing the system to safely relocate only unreachable objects without corrupting reachable ones, thus resolving the contradiction between safety and efficiency

Inventive Principle:
Principle #24Intermediary (Mediator)

2Ease of operation

If traditional single-pass sliding compaction is used, then the process is simpler and faster, but it cannot safely handle multiprocessor environments where objects may be accessed concurrently

Engineering Contradiction:
Improvecompaction simplicityVSAvoidmultiprocessor compatibility
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The patent segments the compaction process into two distinct passes: a marking pass that identifies reachable objects, and a sliding pass that relocates unreachable objects. This segmentation allows the system to maintain simplicity in each individual pass while achieving multiprocessor compatibility through the coordinated two-pass approach, where the marking phase establishes safety information that the sliding phase can rely upon

Inventive Principle:
Principle #1Segmentation

3Device complexity

If the heap is compacted without dividing into chunks, then the compaction process is more straightforward, but parallel processing capability is reduced

Engineering Contradiction:
Improvecompaction process complexityVSAvoidparallel processing capability
Core Design Contradiction:
Device complexityVSProductivity

Solution Approach 1:

The patent divides the heap into fixed-sized chunks or segments that can be independently processed by different processor threads. Each chunk can be marked and compacted in parallel during the two-pass process, significantly improving parallel processing capability. The chunking approach adds some structural complexity but enables efficient parallel execution, resolving the contradiction between simplicity and parallelism

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS7533228B1Two-pass sliding compaction
Publication Date: 2009.05.12 ORACLE AMERICAN INC
  • US7533228B1 patent drawing
  • US7533228B1 patent drawing
  • US7533228B1 patent drawing

AI summary

During two-pass sliding compaction, a heap may first be logically divided into fixed-sized segments, or chunks, and information regarding each chunk, known as per-chunk metadata, may be saved for use during the second, sliding phase. In addition to the per-chunk information, information regarding the location and size, called object extent information, may also be saved during the marking phase of two-pass sliding compaction. In the sliding phase of two-pass sliding compaction, live objects are moved to their respective destinations in the heap after first updating any object references in the objects. The order of objects being moved may be maintained across heap compaction. By relying upon the per-chunk and object extent information saved during the marking phase, objects may be processed individually and independent of each other during the sliding phase, according to some embodiments.