Memory Leak Origin Detection via Collection Tracking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current technologies struggle to accurately determine the origins of memory leaks in source code without requiring the server to crash multiple times, and they often fail to uniquely identify the cause of memory leaks due to the complexity of thread call stacks.
Innovation Solution
A computer-implemented method that involves writing memory dumps, searching for suspect leaking collections, creating unique identifiers for these collections, tracking code paths that add objects to these collections, and logging the code paths for review by developers.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If memory dumps are analyzed by comparing call stacks at memory exhaustion moments, then memory leak origins can be identified, but the server must crash multiple times which causes loss of time and service interruption
Solution Approach 1:
The system performs preliminary actions by instrumenting the application code before memory exhaustion occurs. Call stack tracking and memory state capture are set up in advance, allowing the system to collect diagnostic information during normal operation rather than waiting for crashes. This enables memory leak identification without requiring the server to crash multiple times.
Solution Approach 2:
The system introduces an intermediary mechanism that monitors memory allocations and tracks call stacks without requiring actual memory exhaustion. This intermediary tracking system captures relevant information during normal operation, acting as a mediator between memory usage and leak detection, eliminating the need for crash-based analysis.
2Measurement precision
If thread call stacks are collected during memory threshold violations, then memory usage patterns can be correlated, but there will be a large number of threads executing simultaneously making it difficult to uniquely determine the leak cause
Solution Approach 1:
The system segments the analysis by focusing on specific suspicious collections identified through memory pattern analysis rather than analyzing all threads simultaneously. By dividing the problem into identifying suspect collections first, then tracing their specific call stacks, the system reduces the complexity from analyzing all concurrent threads to analyzing only the relevant subset associated with memory leaks.
Solution Approach 2:
The system applies local quality by concentrating analysis resources on specific suspicious collections and their associated call stacks rather than uniformly analyzing all threads. This targeted approach assigns different levels of analysis depth to different parts of the system based on their suspiciousness, reducing overall complexity while maintaining detection precision.
Data Source
AI summary
A computer-implemented method, a computer program product, and a computer system for determining origins of memory leaks in source code. A computer system writes a first memory dump, in response to a memory leak being detected. A computer system searches the first memory dump to determine types of suspect leaking collections. A computer system creates identifiers for respective instances of each of the types. A computer system writes a second memory dump, in response to a continued memory leak being detected. A computer system determines which unique identifiers from the second memory dump correspond to growing collection objects of the types. A computer system tracks code paths of calls that add objects to collections whose identifiers match one of the unique identifiers. A computer system logs the code paths for review by developers.


