Memory Leak Detection via Class Size Sampling
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional memory leak detection techniques require programmer access to source code and are inefficient, leading to delayed diagnosis and negative impacts on system performance due to memory exhaustion and application crashes.
Innovation Solution
A computer system and method for monitoring classes in a production environment to detect memory leaks by tracking the sizes of static and non-static fields of collection or array types, using a polling mechanism to periodically sample size data and an algorithm to identify suspect behavior, thereby detecting potential memory leaks without significant performance impact.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If conventional memory leak detection techniques are used (requiring source code access), then memory leaks can be diagnosed, but system performance deteriorates due to delayed diagnosis and memory exhaustion
Solution Approach 1:
The system performs preliminary actions by instrumenting classes and registering memory allocation sites before memory leaks occur in production. The instrumentation manager identifies and tracks memory allocation patterns in advance, so when memory leaks happen, the system can immediately detect and report them without requiring source code access during the leak event, thus maintaining both detection accuracy and system performance
Solution Approach 2:
The patent introduces an intermediary layer consisting of the instrumentation manager, memory allocation tracker, and polling mechanism that sits between the application code and the memory management system. This intermediary continuously monitors memory allocation and deallocation patterns, enabling detection of memory leaks without requiring direct access to source code or interrupting normal application execution, thereby resolving the contradiction between detection capability and system performance
2Measurement precision
If memory is monitored continuously to detect leaks, then detection accuracy improves, but performance deteriorates due to monitoring overhead
Solution Approach 1:
The system implements periodic action through the polling mechanism that samples memory allocation data at predetermined intervals rather than continuously monitoring. The algorithm handler processes size data periodically to identify suspect behavior patterns, which maintains detection precision while significantly reducing the computational overhead and resource consumption associated with constant monitoring
Solution Approach 2:
The patent applies partial action by focusing monitoring efforts only on classes and memory allocation sites that are suspected of potential leaks. The instrumentation manager selectively tracks specific containing classes and their fields, and the algorithm handler identifies suspect behavior in specific fields, rather than monitoring all memory operations uniformly, thus achieving good detection precision with reduced computational resources
Data Source
AI summary
In accordance with aspects of the disclosure, systems and methods are provided for monitoring one or more classes for detecting suspected memory leaks in a production environment. The systems and methods may include identifying which of the one or more classes hold at least one static or non-static field of collection or array type, accessing the one or more classes that hold the at least one static or non-static fields of collection or array type, and tracking a size for each field of each class by periodically sampling the size of each field over an interval, processing the size data for each field of each class, and detecting suspected memory leaks of each class by identifying which of the one or more fields of each class exhibits suspect behavior in the size over the interval.


