Optimistic Memory Reclamation via Generation Counters

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing memory management systems face challenges in efficiently reclaiming explicitly managed memory in the presence of optimistic concurrency, particularly in multiple threaded systems, leading to scalability bottlenecks and space leaks, especially with large transactions.

Innovation Solution

A non-blocking memory management approach that uses malloc and free operations to avoid expensive atomic operations, integrates tightly with software transactional memory (STM), and employs thread-local data access to maintain efficient memory allocation and deallocation, including speculative allocation and tentative freeing mechanisms to handle nested transactions and space leaks.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If reference counting or hazard pointers are used to manage memory with optimistic concurrency, then memory reclamation safety is improved, but implementation cost increases due to expensive atomic operations

Engineering Contradiction:
Improvememory reclamation safetyVSAvoidimplementation cost
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent introduces a generation counter as an intermediary mechanism between memory allocation and reclamation. Instead of using expensive atomic operations like reference counting or hazard pointers, the system uses a simple generation number that increments with each allocation wave. Memory can be reclaimed when its generation number is less than the current generation, providing a cheap yet safe reclamation mechanism that avoids atomic operations while maintaining memory safety.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent changes the parameter used for memory reclamation from complex atomic state (like reference counts or hazard pointer flags) to a simple integer generation counter. This parameter change allows the system to track memory liveness through generation numbers rather than atomic operations, significantly reducing implementation cost while maintaining the ability to safely reclaim memory in an optimistic concurrency setting.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If the root set traversal method is used to detect reachable objects, then memory reclamation accuracy is improved, but performance deteriorates due to impractical traversal for large synchronization blocks

Engineering Contradiction:
Improvememory reclamation accuracyVSAvoidperformance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent extracts the expensive root set traversal operation from the critical path of memory management. Instead of traversing the entire root set at every allocation or reclamation point, the system extracts only the necessary information (generation counter) and uses it for quick reclamation decisions. This extraction eliminates the performance bottleneck of full root set traversal while maintaining reclamation accuracy through generation-based tracking.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent performs preliminary action by maintaining a generation counter that is updated with each allocation wave. This preliminary tracking of memory generations allows the system to make immediate reclamation decisions without performing expensive root set traversals. The generation counter is prepared and maintained in advance, enabling fast reclamation checks that do not require traversing large synchronization blocks.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If memory is deferred for freeing until transaction commit, then space leaks are prevented, but memory utilization deteriorates due to space leaks in the presence of large transactions

Engineering Contradiction:
Improvespace leak preventionVSAvoidmemory utilization
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent introduces dynamic memory reclamation based on generation counters that allow memory to be freed at multiple points rather than strictly at transaction commit. The system dynamically determines when memory can be reclaimed by comparing generation numbers, enabling early reclamation of memory that is no longer needed while still protecting against space leaks. This dynamic approach improves memory utilization by freeing memory as soon as it becomes safe, rather than waiting for transaction commit.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent performs preliminary reclamation of memory by using generation counters to identify and free memory that is no longer needed, even before transaction commit. This preliminary action allows the system to reclaim memory early when the generation counter indicates safety, preventing space leaks while improving memory utilization. The generation-based mechanism enables proactive memory reclamation without waiting for transaction boundaries.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS7478210B2Memory reclamation with optimistic concurrency
Publication Date: 2009.01.13 INTEL CORP
  • US7478210B2 patent drawing
  • US7478210B2 patent drawing
  • US7478210B2 patent drawing

AI summary

Memory reclamation with optimistic concurrency is described. In one example an allocated memory object is tentatively freed in a software transactional memory, the object having pointers into it from at least one transaction. A time when all transactions that are outstanding at the time an object is tentatively freed have ended is detected, and the object is actually freed based on the detection.