Dynamic Memory Scope for Preventing Invalid Access

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In enterprise-class software, concurrent memory allocation and deallocation requests from multiple threads or processes can lead to memory corruption due to invalid memory access, making it difficult to identify and correct the root cause of errors or crashes, as these issues often manifest non-deterministically and far removed from the actual perpetrator.

Innovation Solution

Implementing a system that defines a dynamic scope for memory operations, ensuring monotonically increasing memory allocation and protecting deallocated memory to prevent reuse, using OS and hardware-level facilities to enforce memory access permissions, thereby trapping and terminating processes attempting to access protected memory, and removing protections once the operation completes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If memory is shared and reused across multiple threads/processes, then memory utilization efficiency is improved, but the risk of memory corruption and invalid access increases

Engineering Contradiction:
Improvememory utilization efficiencyVSAvoidmemory safety
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system performs preliminary actions by defining a dynamic scope and establishing monotonic allocation rules before memory operations occur. When memory is deallocated, the system proactively protects it from future allocation within the same scope, preventing invalid access before it can happen. This preliminary protection mechanism ensures that even though memory is shared and reused, the reliability is maintained by preventing corruption at the source.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If memory allocation is dynamic and flexible, then adaptability is improved, but the difficulty of detecting and measuring invalid access increases

Engineering Contradiction:
Improvememory allocation flexibilityVSAvoidinvalid access detection
Core Design Contradiction:
Adaptability or versatilityVSDifficulty of detecting and measuring

Solution Approach 1:

The system implements feedback by continuously tracking memory allocation and deallocation events within a defined scope. When memory is deallocated, the system provides feedback by protecting that memory region and monitoring for any subsequent access attempts. If invalid access is detected, the system immediately terminates the offending thread, providing real-time detection and measurement capability that works seamlessly with dynamic memory allocation.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The system uses memory protection markers (analogous to color changes) to indicate the state of memory regions. When memory is deallocated, it is marked as protected/unavailable for allocation. This visual/state-based indication makes it easy to detect and measure the state of memory regions, transforming the invisible problem of invalid access into a detectable condition through protection markers.

Inventive Principle:
Principle #32Color changes

3Reliability

If memory protection mechanisms are implemented, then reliability is improved, but device complexity increases

Engineering Contradiction:
Improvememory access safetyVSAvoidmemory management complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system segments memory management by introducing dynamic scopes that partition memory allocation into isolated regions. Each scope maintains its own allocation history and protection state, allowing memory protection to be applied locally rather than globally. This segmentation reduces complexity by limiting the scope of protection tracking to relevant memory regions only, while still providing comprehensive safety within each segment.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS11573713B1Identifying and preventing invalid memory access
Publication Date: 2023.02.07 SALESFORCE INC
  • US11573713B1 patent drawing
  • US11573713B1 patent drawing
  • US11573713B1 patent drawing

AI summary

Methods, computer readable media, and devices for identifying and preventing invalid memory access. A method may include defining a dynamic scope for an operation, receiving a request to allocate a portion of the range of shared memory, allocating a monotonically increasing portion of the range of shared memory such that a subsequent request to allocate memory is allocated a different portion of the range of shared memory, receiving a request to deallocate the allocated portion of the range of shared memory, deallocating the allocated portion of the range of shared memory by protecting the deallocated portion of the range of shared memory from any subsequent access, and in response to an access of the protected deallocated portion of the range of shared memory by one of the one or more threads or processes of the operation, trapping and terminating the one thread or process.