Database Memory Leak Detection via Allocation Tracing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face challenges in detecting and troubleshooting memory leaks, which can accumulate gradually and are difficult to reproduce, leading to inefficient diagnostic approaches and performance issues.
Innovation Solution
Implementing a system that traces memory allocations and deallocations during query processing in database systems, generating a memory leak tracing file, and analyzing it to identify un-deallocated memory addresses, with actions taken to address detected leaks such as generating a report and making memory available.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Difficulty of detecting and measuring
If memory leak detection is performed manually through diagnostic approaches, then diagnostic complexity is reduced, but detection efficiency and time consumption worsen
Solution Approach 1:
The system performs preliminary memory allocation tracing during normal query processing by intercepting and recording allocation calls in a tracing file. This preliminary action prepares the data structure before analysis is needed, so when memory leak detection is required, the system can quickly analyze pre-captured allocation patterns without time-consuming manual diagnostics
Solution Approach 2:
The patent introduces an intermediary tracing file that captures memory allocation information between the database system and the analysis process. This intermediary structure decouples the detection mechanism from manual diagnostic approaches, allowing automated analysis of allocation patterns to identify leaks without direct system intervention or complex diagnostic procedures
2Measurement precision
If comprehensive memory tracing is performed during all query processing phases, then memory leak detection accuracy is improved, but system performance and complexity worsen
Solution Approach 1:
The patent segments the memory tracing process into distinct query processing phases (parsing, pre-processing, planning, optimization, post-processing, exception handling). Each phase is traced independently with phase identifiers recorded in the tracing file, allowing precise identification of where memory leaks occur without requiring a monolithic complex tracing system
Solution Approach 2:
The system performs partial tracing by focusing only on memory allocation calls during query processing phases, rather than tracing all system operations. The tracing file records only relevant allocation information (memory addresses, timestamps, phase identifiers), providing sufficient precision for leak detection while avoiding excessive complexity from comprehensive system-wide tracing
3Reliability
If memory allocation tracing is performed during all processing phases, then memory leak identification capability is improved, but query processing speed worsens
Solution Approach 1:
The system creates a copy of memory allocation information in a tracing file during query processing, rather than analyzing allocations in real-time. The tracer intercepts allocation calls and writes them to the tracing file with minimal overhead, allowing the original query processing to continue at normal speed while the copied data is analyzed separately for memory leak detection
Solution Approach 2:
The patent implements periodic tracing where memory allocation information is captured during query processing and then analyzed in periodic batches. The tracing file accumulates allocation data during normal operation, and analysis is performed periodically to identify leaks, separating the performance-critical query processing from the computationally intensive leak detection analysis
Data Source
AI summary
The present disclosure involves systems, software, and computer implemented methods for efficient memory leak detection in database systems. One example method includes receiving a query at a database system. Memory allocations and deallocations are traced during processing of the query. Each memory allocation entry in a tracing file can be processed, including determining, for each allocation, whether a memory deallocation entry exists in the tracing file. A determination can be made as to whether a memory leak has occurred in response to determining whether a memory deallocation entry corresponding to a memory allocation entry exists in the tracing file. For example, a determination can be made that a memory leak has occurred in response to determining that no memory deallocation entry corresponding to an allocated memory address exists in the tracing file. One or more actions can be performed in response to determining that a memory leak has occurred.


