Memory Leak Detection via Random App Runs and Snapshot Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing memory leak detection methods require manual triggering of applications, leading to low efficiency and limited detection of memory leaks in a small number of classes, reducing overall effectiveness.
Innovation Solution
A method and apparatus for automatically generating a running instruction for an application, obtaining memory snapshots, and performing memory leak detection on specified classes, including service-related classes, to improve detection efficiency and comprehensiveness.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of manufacture
If manual triggering is used to run the application for memory leak detection, then the detection process is simple to implement, but the detection efficiency is low and labor participation is high
Solution Approach 1:
The detection system automatically triggers application execution and performs memory leak detection without manual intervention. The automated detection agent monitors memory usage, captures snapshots, and analyzes leaks independently, eliminating the need for manual page triggering while maintaining implementation simplicity through standardized automated workflows
Solution Approach 2:
Manual mechanical triggering operations are replaced with an automated detection system that uses software agents to programmatically execute applications, monitor memory states, and analyze leaks. This substitution of manual mechanical actions with automated software control significantly improves detection efficiency while keeping the system easy to implement through standardized interfaces
2Ease of operation
If a tool package is used to detect memory leaks, then the detection process is straightforward, but the detection scope is limited to a small number of classes
Solution Approach 1:
The detection system is designed to universally handle memory leak detection across multiple application classes and frameworks. The automated detection agent can adapt to different class structures, service types, and application architectures, enabling comprehensive detection across the entire codebase rather than being limited to specific predefined classes
Solution Approach 2:
The detection system dynamically adapts to the application's class structure and service types during runtime. The automated agent can identify and monitor relevant classes based on actual execution patterns and memory usage characteristics, allowing the detection scope to expand and contract dynamically according to the application's needs rather than being fixed to a small predetermined set of classes
3Productivity
If automated random running instructions are generated and multiple classes are detected, then the detection efficiency and comprehensiveness improve, but the system complexity increases
Solution Approach 1:
The complex detection system is segmented into modular functional components: an automated detection agent for triggering applications, a memory snapshot capture module, and an analysis engine for identifying leaks. Each module handles a specific aspect of the detection process independently, which manages system complexity through functional decomposition while enabling comprehensive multi-class detection across service-related, utility, and core business classes
Data Source
AI summary
Embodiments of the present disclosure provide a memory leak detection method and apparatus, an electronic device, and a storage medium. The method includes: obtaining a memory leak detection instruction for a first application, and generating a running instruction for the first application based on the memory leak detection instruction randomly; triggering the first application to run based on the running instruction, and obtaining running data of the first application; obtaining a memory snapshot of the first application in response to the running data of the first application meeting a running data requirement; and performing memory leak detection on a plurality of first specified classes of the first application based on the memory snapshot of the first application. The first specified classes include service-related classes in the first application.


