Memory Leak Detection via Object Segmentation and Counter Thresholds
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current methods for detecting memory leaks, such as Oracle JRockit Mission Control and IBM HeapAnalyzer, are inadequate in identifying small leaks, leaks that occur over time, and leaks in systems with periodic memory usage issues, and they can excessively load the system and reduce accuracy due to recording access information for all objects.
Innovation Solution
A method involving producing an object in a first memory area, checking for a pointer, incrementing a counter, moving the object to a second area when the counter exceeds a threshold, clearing the counter, and outputting the object when it exceeds another threshold, to effectively detect and manage memory leaks.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If entire access information of all objects is recorded to detect memory leaks, then detection accuracy is improved, but system load increases excessively
Solution Approach 1:
The patent segments memory into multiple areas (first area and second area) and divides object monitoring into different levels. Objects are selectively monitored based on their location and access patterns, rather than recording access information for all objects uniformly. This segmentation reduces the monitoring scope to only those objects that meet specific criteria (e.g., objects moved to second area), thereby reducing system load while maintaining detection accuracy for actual memory leaks.
Solution Approach 2:
The patent applies different monitoring strategies to different parts of the memory system. Objects in the first area are monitored with standard GC rules, while objects in the second area (which have been moved due to specific access patterns) are monitored with enhanced tracking. This local quality approach focuses monitoring resources on the most suspicious objects rather than uniformly monitoring all objects, reducing overall system load while improving leak detection accuracy where needed.
2Measurement precision
If objects are monitored for extended periods to identify memory leaks, then detection accuracy is improved, but time consumption increases
Solution Approach 1:
The patent performs preliminary actions by moving objects to the second area before extensive monitoring is required. Objects that exhibit specific access patterns (being accessed after being in the first area for a certain period) are proactively moved to the second area, where they are then monitored with enhanced tracking. This preliminary classification reduces the time needed for subsequent monitoring, as only objects in the second area require extended observation to confirm memory leaks, rather than all objects needing prolonged monitoring.
3Ease of operation
If GC is implemented to manage memory automatically, then programming complexity is reduced, but memory leaks from unused objects with persistent pointers cannot be detected
Solution Approach 1:
The patent introduces an intermediary mechanism (the area movement system with first area and second area) between the GC process and memory leak detection. This intermediary tracks object movement and access patterns, providing additional information to the detection system. The intermediary records which objects are moved to the second area and their access histories, enabling the detection system to identify memory leaks that would otherwise be invisible to standard GC tools, while maintaining the automatic memory management benefits of GC.
Data Source
AI summary
A memory leak detecting method includes: producing an object which occupies an area on a first area of the memory; checking a presence of a pointer which points at the object separately so as to remove the object and to repeatedly carry out a process for increasing a counter value of the object; moving the object from the area on the first area of the memory to an area on the second area of the memory when the counter value exceeding a first threshold; and moving the object from the area on the second area to the area on the first area and clearing the counter value of the object upon the object occupying the area on the second area.


