Memory leak trend analysis method based on window sliding detection of memory growth
Patent Information
- Application Number
- CN202610857778.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-09-25
AI Technical Summary
[0005]因此,本发明提供了基于窗口滑动检测内存增长的内存泄漏趋势分析方法解决难以准确识别多时间尺度下的内存泄漏趋势和泄漏判定依据缺乏结构化归集和可信输出问题
[0041]本发明有益效果为:通过基础内存分析序列确定窗口自适应参数并生成多尺度滑动窗口集合,实现了对不同时间尺度下内存增长过程的分层表征和连续跟踪,达到了缓慢泄漏、局部突增以及阶段性波动能够在统一分析链路中被同步识别;通过识别释放事件点、提取释放后基线值并分析连续增长区间与残留抬高区间的对应分析,实现了对释放后基线残留与持续增长行为的联合判定,达到了提高内存泄漏趋势识别准确性、降低误判漏判并增强判定信息可追溯性和工程应用价值的效果。
Smart Images

Figure CN122817045A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of memory leak detection technology, and in particular to a method for analyzing memory leak trends based on window sliding detection of memory growth. Background Technology
[0002] With the development of automated performance testing, continuous integration regression verification, and cloud-native application monitoring technologies, memory usage data has gradually become an important time-series information for software stability analysis. Existing technologies typically collect process memory, container memory, or service instance memory continuously through monitoring components, performance profiling tools, or testing platforms, and use the sampling results for trend display, alarm triggering, and anomaly backtracking. Based on this, some solutions determine whether memory usage is continuously increasing by comparing the average of fixed time windows, fixed sampling segments, or previous and subsequent time periods. Other solutions combine slope estimation, threshold judgment, or garbage collection log analysis to assist in the identification of potential memory leaks. Related technologies have evolved from simply collecting memory data to using memory time series for runtime status analysis.
[0003] Existing technologies still have shortcomings. First, many solutions still rely on fixed windows, static thresholds, or comparisons of the difference between the beginning and end of a memory flow, lacking joint analysis of memory growth processes at different time scales and targeted identification of baseline changes before and after release events. Therefore, it is difficult to distinguish between phased increases caused by business load and unrecoverable leakage trends after release, easily leading to misjudgments or missed judgments when slow leakage, localized declines, and fluctuating noise coexist. Second, most existing solutions remain at the level of outputting growth values or alarm texts, lacking structured aggregation of continuous growth intervals, residual increase intervals, release event locations, and their corresponding relationships, resulting in scattered judgment criteria and unclear verification links. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a memory leak trend analysis method based on window sliding detection of memory growth to solve the problems of difficulty in accurately identifying memory leak trends at multiple time scales and the lack of structured collection and reliable output of leak judgment criteria.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] This invention provides a memory leak trend analysis method based on window sliding detection of memory growth, comprising: acquiring memory usage records during the testing process, sorting, deduplicating, and filtering the memory usage records to form a basic memory analysis sequence; determining window adaptive parameters based on the basic memory analysis sequence, and generating a multi-scale sliding window set using the window adaptive parameters; calculating the window memory change feature values of each sliding window in the multi-scale sliding window set to form a multi-scale window feature table; identifying locally significant decline segments based on the multi-scale window feature table to form a release event point set, extracting pre-release and post-release analysis windows based on each release event point, and extracting the post-release baseline value from the post-release analysis window; performing a time-series comparison of the post-release baseline value to form a baseline residual feature set, and combining the multi-scale window feature table to identify the correspondence between continuous growth intervals and residual increase intervals to form a leak trend determination table; collecting and encapsulating the leak trend feature information recorded in the leak trend determination table to generate a leak trend evidence package, and obtaining memory leak trend determination information based on the leak trend evidence package.
[0008] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for forming the basic memory analysis sequence are as follows:
[0009] Obtain memory usage records during the test process, and extract sampling timestamps, object identifiers, and memory values from the memory usage records to form the original memory record set;
[0010] The original memory record set is rewritten with a unified unit and sorted by time to obtain time-ordered records. The time-ordered records are then divided into time buckets and duplicates are removed to form a deduplicated ordered record set.
[0011] The deduplicated ordered record set is subjected to anomaly filtering, and the deduplicated ordered record set after anomaly filtering is time-series organized to form a basic memory analysis sequence.
[0012] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for determining the window adaptive parameters based on the basic memory analysis sequence are as follows:
[0013] The basic memory analysis sequence is divided into multiple continuous sampling segments according to the sampling continuity, and a scale candidate set corresponding to the sampling length is established to obtain the scale analysis sequence.
[0014] The intensity of local variation at different scales of each sampling segment location is obtained from the scale analysis sequence, and a scale energy map is constructed.
[0015] The scale energy map is used to perform front and back interval drift difference analysis on the location of each sampling segment to determine the span of the mother window corresponding to the location of each sampling segment;
[0016] The span of the parent window is mapped hierarchically to obtain the parameters of the short-scale window, the medium-scale window, the long-scale window, and the sliding step size, forming a window adaptive parameter table.
[0017] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps of generating a multi-scale sliding window set using window adaptive parameters are as follows:
[0018] The timeline is arranged according to the window parameters in the window adaptation parameter table to generate sliding windows of different scales;
[0019] Based on sliding windows of different scales, overlapping and rearrangement are performed on adjacent windows at the same scale, and nesting and rearrangement are performed on windows at different scales to obtain a multi-scale sliding window set.
[0020] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for forming the multi-scale window feature table are as follows:
[0021] The sliding windows in the multi-scale sliding window set are standardized, and the trend reference information corresponding to each sliding window is extracted to form a trend reference group.
[0022] Based on the trend reference group, path deviation analysis is performed on each sliding window to obtain the corresponding deviation amount. Then, the pullback depth, recovery closure and tail stability are extracted from the deviation amount to form a path structure description group.
[0023] The trend reference group and the path structure description group are integrated to calculate the window memory change characteristic value of each sliding window, and then collected according to the window number and scale number to form a multi-scale window feature table.
[0024] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for forming the set of release event points are as follows:
[0025] Temporal and scale correlations are performed on the feature records of each window in the multi-scale window feature table, and cross-scale descent candidate chains are identified to determine locally significant descent segments.
[0026] The locations of locally significant decline segments are refined to form a set of release event points.
[0027] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps of extracting the pre-release analysis window and the post-release analysis window according to each release event point, and extracting the post-release baseline value from the post-release analysis window, are as follows:
[0028] A release window table is obtained by performing asymmetric pre- and post-capture windowing on each release event point in the release event point set.
[0029] Based on the post-release analysis windows in the release window table, identify stable plateau segments with local slope convergence and limited fluctuation amplitude, and extract post-release baseline values from the stable plateau segments.
[0030] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for forming the baseline residual feature set are as follows:
[0031] The baseline values after release are processed temporally and compared stepwise to identify residual change segments that gradually rise and are limited in local fallback, forming a linear residual feature set.
[0032] Based on the baseline residual feature set, the residual change segment is purified by interval extraction to obtain the residual elevation interval that maintains a continuous elevation state.
[0033] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for forming the leak trend determination table are as follows:
[0034] A multi-scale window feature table is used to merge window feature records that have the same growth direction and are continuous in time to identify continuous growth intervals, and then a monotonic correspondence analysis is performed between the continuous growth intervals and the residual elevation intervals.
[0035] Based on the information from monotonic correspondence analysis, the effective correspondence between the continuous growth interval and the residual increase interval is determined, and a leakage trend judgment table is formed according to the correspondence intensity and interval persistence.
[0036] As a preferred embodiment of the memory leak trend analysis method based on window sliding detection of memory growth described in this invention, the specific steps for collecting and encapsulating the leak trend feature information recorded in the leak trend determination table to generate a leak trend evidence package, and obtaining memory leak trend determination information based on the leak trend evidence package are as follows:
[0037] The judgment items in the leakage trend judgment table are broken down and collected, and the time interval information, interval correspondence information and source association information corresponding to each judgment item are extracted from the leakage trend judgment table to form an evidence list.
[0038] Based on the evidence list, various types of evidence corresponding to the same judgment item are organized into a relationship set to form a leakage trend evidence atlas corresponding to each judgment item;
[0039] The leakage trend evidence atlas is used to perform trusted encapsulation and digest solidification on each evidence graph to form a leakage trend evidence package;
[0040] Based on the encapsulation credibility, digest verification status, and interval correspondence in the leakage trend evidence package, memory leakage trend determination information is obtained.
[0041] The beneficial effects of this invention are as follows: By determining the adaptive parameters of the window through the basic memory analysis sequence and generating a multi-scale sliding window set, a hierarchical characterization and continuous tracking of the memory growth process at different time scales is achieved, enabling the synchronous identification of slow leakage, local surges, and stage fluctuations in a unified analysis link; by identifying release event points, extracting the baseline value after release, and analyzing the correspondence between the continuous growth interval and the residual rise interval, the joint determination of the baseline residue after release and the continuous growth behavior is achieved, thereby improving the accuracy of memory leak trend identification, reducing false positives and false negatives, and enhancing the traceability of determination information and its engineering application value. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart of a memory leak trend analysis method based on window sliding detection of memory growth.
[0044] Figure 2 A flowchart for generating the basic memory analysis sequence.
[0045] Figure 3 A flowchart for determining the adaptive parameters of the window.
[0046] Figure 4 The flowchart for generating a multi-scale window feature table. Detailed Implementation
[0047] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0048] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0049] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0050] Reference Figures 1-4 This is one embodiment of the present invention, which provides a method for analyzing memory leak trends based on window sliding detection of memory growth, including the following steps:
[0051] S1. Obtain memory usage records during the test process, and sort, deduplicate, and filter out anomalies from these records to form a basic memory analysis sequence.
[0052] Obtain memory usage records during the test process, and extract sampling timestamps, object identifiers, and memory values from the memory usage records to form the original memory record set.
[0053] The specific process includes continuously receiving memory usage records during the test, reading each memory usage record one by one, splitting and identifying the content in the memory usage records, extracting the sampling timestamp, object identifier, and memory value at the corresponding positions, maintaining a one-to-one correspondence between the sampling timestamp, object identifier, and memory value corresponding to the same memory usage record and organizing them in parallel, so that the sampling timestamp can be mapped to the object identifier, and the object identifier can be mapped to the memory value, so that the sampling timestamp, object identifier, and memory value can completely reflect the content collected in a memory usage record, and continuously collecting all extracted sampling timestamps, object identifiers, and memory values according to the record source to form the original memory record set.
[0054] The original memory record set is rewritten with unified dimensions and sorted by time to obtain time-ordered records. The time-ordered records are then divided into time buckets and duplicates are filtered out to form a deduplicated ordered record set.
[0055] The specific process includes: unifying the units of memory values in the original memory record set to transform them into a consistent representation; arranging the records after unifying the units of memory according to the chronological order of their sampling timestamps to obtain time-ordered records; further segmenting and organizing the records in the time-ordered records according to the time intervals corresponding to their sampling timestamps; grouping records with similar sampling times and falling within the same time range into the same time bucket, so that each time bucket corresponds to a group of records with similar time positions; comparing each record in the time bucket item by item to check whether the sampling timestamps, object identifiers, and memory values in the records are complete; checking whether the time positions between different records in the same time bucket are clear; and checking whether there are duplicate sampling timestamps, duplicate object identifiers, or duplicate record content in the same time bucket. After item-by-item comparison, records with complete content and clear time positions are retained, while duplicate records are removed, so that only valid records that can represent the corresponding time range are retained in the time bucket. Finally, the records retained in each time bucket are re-concatenated according to their chronological order to form a deduplicated ordered record set.
[0056] It should be noted that unified unit conversion refers to the process of converting memory values expressed in different units of measurement into memory values expressed in the same unit of measurement.
[0057] The deduplicated ordered record set is subjected to anomaly filtering, and the deduplicated ordered record set after anomaly filtering is time-series organized to form a basic memory analysis sequence.
[0058] The specific process includes: sequentially checking each record in the deduplicated ordered record set; reading the sampling timestamp, object identifier, and memory value of each record; checking for missing, disordered, or conflicting sampling timestamps; checking for missing or mismatched object identifiers; and checking for missing, abnormally deviated, or mismatched memory values. Records with abnormal memory values, abnormal sampling timestamps, or incomplete content are removed from the deduplicated ordered record set, resulting in a deduplicated ordered record set after anomaly filtering. All records in the deduplicated ordered record set are then rearranged according to the chronological order of their sampling timestamps, placing earlier records at the beginning and later records at the end. The temporal continuity between adjacent records is checked to ensure that all records form a continuous temporal sequence with the preceding and following records, while maintaining the correspondence between sampling timestamps, object identifiers, and memory values. Finally, all records after temporal ordering are concatenated sequentially to form a basic memory analysis sequence.
[0059] S2. Determine the window adaptation parameters based on the basic memory analysis sequence, and use the window adaptation parameters to generate a multi-scale sliding window set.
[0060] The basic memory analysis sequence is divided into multiple continuous sampling segments according to the sampling continuity, and a scale candidate set corresponding to the sampling length is established to obtain the scale analysis sequence.
[0061] The specific process includes: checking the continuity of each record in the basic memory analysis sequence according to the time interval corresponding to the sampling timestamp; sequentially merging records with normal time connection between adjacent records without interruption, so that the records with continuous time distribution form corresponding continuous sampling segments; separating the positions where the time interval is interrupted or the continuity is broken, so that the basic memory analysis sequence is divided into multiple continuous sampling segments; organizing the number of records and time span in the continuous sampling segments; establishing a scale candidate set corresponding to the sampling length of the continuous sampling segments, so that each continuous sampling segment corresponds to a set of scale candidate contents that can reflect different observation granularities; and associating and organizing the continuous sampling segments with the corresponding scale candidate sets to obtain the scale analysis sequence.
[0062] The intensity of local changes at different scales of each sampling segment location is obtained from the scale analysis sequence, and a scale energy map is constructed.
[0063] The specific process includes processing each sampling segment position in the continuous sampling segment one by one according to the scale candidate set corresponding to each continuous sampling segment in the scale analysis sequence, distinguishing the front and back ranges corresponding to the sampling segment positions at different scales, comparing the changes in memory values within the front and back ranges item by item, identifying the magnitude and concentration of changes of the sampling segment positions relative to neighboring positions at the corresponding scale, organizing the obtained changes into local change intensities at the corresponding scale, and sequentially arranging and associating all local change intensities according to the correspondence between sampling segment positions and scales, so that each sampling segment position corresponds to a set of local change intensities at different scales, and the local change intensities of all sampling segment positions at different scales together constitute a scale energy map.
[0064] The scale energy map is used to perform front and back interval drift difference analysis on the location of each sampling segment to determine the span of the mother window corresponding to the location of each sampling segment.
[0065] The specific process includes: using the local change intensity corresponding to each sampling segment position at different scales in the scale energy map, analyzing each sampling segment position one by one; using the sampling segment position as the interval boundary; constructing a front interval for continuous records before the sampling segment position and a back interval for continuous records after the sampling segment position; reading the local change intensity distribution corresponding to the front and back intervals at different scales; organizing the change amplitude, change concentration, and change continuation status of each record in the front and back intervals; and comparing the changes in the front and back intervals item by item to determine whether there are any changes on both sides of the current sampling segment position. In cases where the range of change expands, the direction of change shifts, and the distribution of change is inconsistent, after sorting out the differences in changes between the preceding and following intervals, and combining the local change intensity level of the current sampling segment position in the scale energy map, a scale range that can simultaneously cover the main change range of the preceding interval and the main change range of the following interval is selected. This ensures that the selected scale range can reflect both the local change boundary near the current sampling segment position and the actual unfolded length corresponding to the difference in changes on both sides of the current sampling segment position. The selected scale range is then rewritten as the window length corresponding to the current sampling segment position, so that the sampling segment position obtains a parent window span that can characterize the drift difference between the preceding and following intervals.
[0066] The span of the parent window is mapped hierarchically to obtain the parameters of the short-scale window, the medium-scale window, the long-scale window, and the sliding step size, forming a window adaptive parameter table.
[0067] The specific process includes: systematically organizing the span of the parent window corresponding to each sampling segment position, using the parent window span as the basic length reference for the corresponding sampling segment position, and dividing it into short-scale window parameters, medium-scale window parameters, long-scale window parameters, and sliding step parameters according to the differences in length and distribution level between parent window spans within the same sampling segment. Smaller parent window spans correspond to short-scale window parameters, medium-scale spans correspond to medium-scale window parameters, and larger spans correspond to long-scale window parameters. Then, considering the changes in the spans of adjacent parent windows at each sampling segment position, a sliding step parameter matching the corresponding window length is determined, ensuring that the short-scale window parameters, medium-scale window parameters, long-scale window parameters, and sliding step parameters maintain a consistent correspondence with the corresponding sampling segment position. Finally, the short-scale window parameters, medium-scale window parameters, long-scale window parameters, and sliding step parameters corresponding to each sampling segment position are collected and organized in the order of the sampling segment position to form a window adaptive parameter table.
[0068] It should be noted that the short-scale window parameter is used to determine the coverage area of the short-scale sliding window; the medium-scale window parameter is used to determine the coverage area of the medium-scale sliding window; the long-scale window parameter is used to determine the coverage area of the long-scale sliding window; and the sliding step size parameter is used to determine the distance the sliding window moves along the time axis.
[0069] The timeline is arranged according to the window parameters in the window adaptation parameter table to generate sliding windows of different scales.
[0070] The specific process includes arranging and organizing each record in the basic memory analysis sequence according to the temporal order of the sampling timestamps, based on the short-scale window parameters, medium-scale window parameters, long-scale window parameters, and sliding step size parameters corresponding to each sampling segment position in the window adaptive parameter table. The sampling segment position is used as the starting and reference position of the corresponding window. The short-scale coverage range is determined based on the short-scale window parameters, the medium-scale coverage range is determined based on the medium-scale window parameters, and the long-scale coverage range is determined based on the long-scale window parameters. The corresponding coverage range is sequentially advanced according to the sliding step size parameters, so that the window expands in a continuous moving manner on the time axis, and the records under different coverage ranges form corresponding short-scale sliding windows, medium-scale sliding windows, and long-scale sliding windows, generating sliding windows of different scales.
[0071] Based on sliding windows of different scales, overlapping and rearrangement are performed on adjacent windows at the same scale, and nesting and rearrangement are performed on windows at different scales to obtain a multi-scale sliding window set.
[0072] The specific process includes comparing adjacent windows continuously distributed along the time axis at the same scale according to the time range and record coverage corresponding to sliding windows of different scales, overlapping and organizing adjacent windows with overlapping time ranges and continuous coverage content, making the window arrangement relationship at the same scale clearer and maintaining the stability of the time unfolding order, organizing the coverage relationship between short-scale, medium-scale, and long-scale sliding windows, nesting windows of different scales with time ranges in an inclusive or corresponding relationship, forming hierarchical and range correspondence relationships between sliding windows of different scales, and collecting all sliding windows of different scales after overlapping and nesting organization according to time order and scale level to obtain a multi-scale sliding window set.
[0073] It should be noted that overlapping sorting refers to comparing adjacent windows that are continuously distributed along the time axis at the same scale one by one, and then reorganizing adjacent windows whose time ranges overlap and whose recorded content is connected according to their time sequence; nested sorting refers to sorting the coverage relationship between short-scale sliding windows, medium-scale sliding windows and long-scale sliding windows, and then grouping windows of different scales whose time ranges are in an inclusive or corresponding relationship according to their hierarchical relationship.
[0074] S3. Calculate the window memory change characteristic values of each sliding window in the multi-scale sliding window set to form a multi-scale window feature table.
[0075] The sliding windows in the multi-scale sliding window set are standardized, and the trend reference information corresponding to each sliding window is extracted to form a trend reference group.
[0076] The specific process includes unfolding and organizing each sliding window in the multi-scale sliding window set one by one, reading the sampling timestamps and memory values corresponding to all records inside each sliding window, rearranging the records inside the window according to the order of the sampling timestamps to ensure that the order of records inside the sliding window is consistent with the order of time unfolding, uniformly rewriting the time position and memory values of each sliding window to ensure that sliding windows under different coverage ranges present a continuous change state under the same comparison caliber, extracting trend reference information that reflects the direction, magnitude, and trend of memory change along the recording order inside the standardized sliding window, and after obtaining the trend reference information corresponding to each sliding window, grouping the trend reference information with the window number and scale number of the corresponding sliding window in parallel, so that each sliding window corresponds to a set of trend reference information, forming a trend reference group.
[0077] It should be noted that trend reference information refers to reference content extracted from the memory changes unfolding sequentially within each sliding window, used to characterize the overall trend of change of the corresponding sliding window.
[0078] Based on the trend reference group, path deviation analysis is performed on each sliding window to obtain the corresponding deviation amount. Then, the pullback depth, recovery closure and tail stability are extracted from the deviation amount to form a path structure description group.
[0079] The specific process includes: based on the trend reference information corresponding to each sliding window in the trend reference group, comparing the memory change trajectory arranged in chronological order within each sliding window segment by segment; analyzing the correspondence between the actual memory change at each position within the sliding window and the change trend represented by the trend reference information; identifying the differences in the direction, magnitude, and position of change at each position; systematically organizing the deviations of the actual change trajectory within the sliding window relative to the trend reference information to obtain the corresponding deviation amounts; continuously checking the deviation amounts within each sliding window in chronological order to determine the downward range formed by the decline of the deviation amount from high to low; and determining the maximum downward amplitude of the deviation amount within the downward range. Extract the retracement depth, organize the changes in deviation at subsequent positions of the descent interval, determine the degree to which the deviation converges to the original level after the pullback, extract the recovery closure from the changes in deviation at subsequent positions of the descent interval, and simultaneously organize the fluctuations in deviation at the tail position of the sliding window to determine the convergence and stability of the fluctuations at the tail position. Extract the tail stability from the fluctuations in deviation at the tail position of the sliding window, and associate and aggregate the retracement depth, recovery closure, and tail stability corresponding to each sliding window with the window number and scale number of the corresponding sliding window, so that each sliding window corresponds to a complete set of path structure description content, forming a path structure description group.
[0080] The trend reference group and the path structure description group are integrated to calculate the window memory change characteristic value of each sliding window, and then collected according to the window number and scale number to form a multi-scale window feature table.
[0081] The specific process includes: matching the trend reference information corresponding to each sliding window in the trend reference group with the retracement depth, recovery closure, and tail stability corresponding to each sliding window in the path structure description group according to the window number and scale number of the same sliding window, so that the trend reference information can be mapped to the retracement depth, recovery closure, and tail stability; integrating and organizing the content of each group, and collecting the content reflecting the direction of memory change, the magnitude of memory change, the trend of change, the degree of fall, the degree of recovery, and the tail stability state into the same sliding window record, obtaining the window memory change feature value corresponding to each sliding window; and collecting the window memory change feature values of each sliding window in order according to the window number and scale number, so that the window memory change feature values under the same window number maintain the correspondence, and the window memory change feature values under the same scale number maintain the hierarchical relationship, forming a multi-scale window feature table from the window memory change feature values corresponding to all sliding windows.
[0082] The expression for calculating the characteristic value of window memory change for each sliding window is as follows:
[0083] ;
[0084] in, Indicates the first The characteristic value of the window memory change of a sliding window; Indicates the first The trend direction strength corresponding to each sliding window; Indicates the first The trend change magnitude corresponding to each sliding window; Indicates the first The trend fluctuation offset corresponding to each sliding window; Indicates the first The pullback depth corresponding to each sliding window; Indicates the first Tail segment stability corresponding to each sliding window; Indicates the first The degree of restoration closure corresponding to each sliding window; Represents a very small positive number; Indicates the number of the sliding window; This represents the inverse hyperbolic sine function.
[0085] It should be noted that, It is obtained by performing statistical analysis on the differences between the memory values arranged in chronological order within the sliding window; It is obtained by combining the change in memory value between the start and end positions within the sliding window with the overall change range within the window. It is obtained by measuring the degree of deviation of the actual memory value at each position within the sliding window from the corresponding change trajectory of the trend reference information; It is obtained by measuring the maximum drop between a local high and a subsequent low in the time sequence of the memory value within the sliding window; It is obtained by measuring the maximum drop between a local high and a subsequent low in the time sequence of the memory value within the sliding window; It is obtained by measuring the maximum drop between a local high value and a subsequent low value in the time sequence of the memory value within the sliding window.
[0086] S4. Identify locally significant decreasing segments based on the multi-scale window feature table to form a set of release event points. Extract the pre-release analysis window and post-release analysis window based on each release event point, and extract the post-release baseline value from the post-release analysis window.
[0087] Temporal and scale correlations are performed on the feature records of each window in the multi-scale window feature table, and cross-scale descent candidate chains are identified to determine locally significant descent segments.
[0088] The specific process includes: arranging and organizing the window feature records in the multi-scale window feature table according to the chronological order of the window numbers; temporally associating window feature records that are sequentially connected and have continuous change directions; comparing window feature records with different scale numbers within the same time range; scale associating window feature records that are close in time position, have the same descent direction, and whose change processes can be mutually verified across different scales; sequentially connecting descent window feature records that simultaneously satisfy temporal continuity and scale correspondence; identifying cross-scale descent candidate chains; merging and organizing the time ranges covered by the cross-scale descent candidate chains; and identifying segments with continuous descent processes, concentrated descent ranges, and consistent orientations in the multi-scale window feature table as locally significant descent segments.
[0089] The locations of locally significant decline segments are refined to form a set of release event points.
[0090] The specific process includes: re-expanding all window feature records in the locally significant decline segment according to their chronological order; checking the window number, scale number, and changes in window memory feature values corresponding to the start, middle, and end positions of the locally significant decline segment; retaining the positions with the most concentrated decline changes, the most continuous time positions, and the most consistent correspondence between window feature records of different scales; removing the offset positions caused by window overlap at both ends of the locally significant decline segment; and organizing the retained positions to correspond with the time range covered by the locally significant decline segment so that each locally significant decline segment corresponds to a time position that can reflect the center position of the decline change. Finally, all time positions that have undergone position refinement are collected in chronological order to form a set of release event points.
[0091] Asymmetric pre- and post-capture windowing is performed on each release event point in the release event point set to obtain the release window table.
[0092] The specific process includes processing each release event point in the release event point set one by one, using the time position corresponding to the release event point as the dividing position, and extracting the record intervals before and after the release event point respectively. The record intervals before the release event point that can reflect the cumulative state of memory changes are organized into the pre-release analysis window, and the record intervals after the release event point that can reflect the fallback state and subsequent change state of memory changes are organized into the post-release analysis window. This makes the pre-release analysis window and the post-release analysis window correspond to each other on both sides of the same release event point. The pre-release analysis window and the post-release analysis window corresponding to the release event point are collected according to the correspondence between the release event point and the time position to obtain the release window table.
[0093] Based on the post-release analysis windows in the release window table, identify stable plateau segments with local slope convergence and limited fluctuation amplitude, and extract post-release baseline values from the stable plateau segments.
[0094] The specific process includes: processing each post-release analysis window in the release window table one by one; arranging the records in the post-release analysis windows sequentially according to time order; organizing the memory changes between adjacent positions within the post-release analysis window segment by segment; comparing the memory change slopes between adjacent positions in the post-release analysis window item by item; determining that the slopes of change before and after each position gradually converge when the absolute value of the slope corresponding to the subsequent position gradually decreases and the difference between adjacent slopes gradually narrows; organizing the fluctuation range of the continuous intervals in the post-release analysis window; determining that the fluctuation amplitude in the continuous interval remains within a limited range when the difference between the maximum and minimum memory values in the continuous interval remains within a limited range and there are no abnormal jumps between adjacent positions; identifying the continuous record interval that simultaneously meets the conditions of local slope convergence and fluctuation amplitude limitation as a stable platform segment; continuing to compare and organize each record in the stable platform segment; extracting the memory values that can represent the overall residence level of the stable platform segment; ensuring that each post-release analysis window corresponds to a stable platform segment and a post-release baseline value corresponding to the stable platform segment; and extracting the post-release baseline value from the stable platform segment.
[0095] S5. Perform time-series comparison of the baseline values after release to form a baseline residual feature set, and combine it with a multi-scale window feature table to identify the correspondence between the continuous growth interval and the residual increase interval, forming a leakage trend determination table.
[0096] The baseline values after release are processed temporally and compared stepwise to identify residual change segments that gradually rise and are limited in local fallback, forming a linear residual feature set.
[0097] The specific process includes arranging the post-release baseline values sequentially according to the time sequence of the corresponding release event points, so that all post-release baseline values are continuously unfolded on the same time axis. The high-low changes between adjacent post-release baseline values are compared and organized item by item. Changes that show an upward trend between adjacent positions are retained. Changes that only show a brief decline and then return to the original upward trend range are merged into the same continuous change interval. The post-release baseline values of each segment after continuous unfolding are further compared in layers, so that post-release baseline values in similar levels are grouped into the same step level, and post-release baseline values that are higher than the previous level are grouped into a higher step level. In this way, residual change segments that gradually rise along the time direction and have limited local decline are identified. The time position, step level change relationship and continuous rising state corresponding to each residual change segment are collected and organized to form a linear residual feature set.
[0098] Based on the baseline residual feature set, the residual change segment is purified by interval extraction to obtain the residual elevation interval that maintains a continuous elevation state.
[0099] The specific process includes comparing and organizing each residual change segment according to its corresponding time position, step level change relationship, and continuous rising state in the baseline residual feature set. Residual change segments that are connected in time, continuously move upward in the step level, and do not show continuous downward movement in the middle are retained as the same continuous interval. Parts that only show short-term fluctuations but do not change the overall rising trend are merged into the corresponding continuous interval. Parts that have interrupted time intervals, fall back in the step level, or have their continuous rising state broken are separated from the corresponding continuous intervals. The continuous intervals after interval purification are grouped according to their time sequence so that each continuous interval maintains a continuous rising state, resulting in residual rising intervals that maintain a continuous rising state.
[0100] It should be noted that the residual elevation interval refers to the interval corresponding to the post-release baseline value that is continuously elevated and obtained from the residual change segment. It is used to characterize the range of changes in the post-release baseline that is continuously higher than the previous level, and to provide a basis for the correspondence analysis between the continuous growth interval and the residual elevation interval.
[0101] We use a multi-scale window feature table to merge window feature records that have the same growth direction and are continuous in time, identify continuous growth intervals, and perform monotonic correspondence analysis between continuous growth intervals and residual elevation intervals.
[0102] The specific process includes: organizing each window feature record in the multi-scale window feature table one by one; comparing the memory change direction corresponding to each window feature record; grouping window feature records with consistent growth direction and continuous temporal position into the same continuous interval in sequence; ensuring that the window feature records in the same continuous interval maintain consistent growth direction and continuous temporal expansion, thereby identifying continuous growth intervals; after identifying continuous growth intervals, organizing the continuous growth intervals and residual elevation intervals according to their temporal order; comparing the start position, end position, and continuation order between the continuous growth intervals and residual elevation intervals item by item; establishing a correspondence between the continuous growth intervals that correspond temporally and have consistent change direction and the residual elevation intervals; separating intervals that cannot maintain consistent temporal order or elevation relationship; and performing monotonic correspondence analysis on the continuous growth intervals and residual elevation intervals.
[0103] Based on the information from monotonic correspondence analysis, the effective correspondence between the continuous growth interval and the residual increase interval is determined, and a leakage trend judgment table is formed according to the correspondence intensity and interval persistence.
[0104] The specific process includes: verifying the correspondence, order, and range between continuous growth intervals and residual rise intervals based on information obtained from monotonic correspondence analysis; identifying continuous growth intervals and residual rise intervals that maintain consistency in time, continuity in change, and stable pairing in intervals as valid correspondences; stratifying the identified valid correspondences according to correspondence strength and interval persistence; recording valid correspondences with high correspondence strength and strong interval persistence that are consistent with their corresponding time ranges; and assigning valid correspondences with low correspondence strength and weak interval persistence to their corresponding time ranges; and collecting all valid correspondences and corresponding level results in chronological order to form a leakage trend determination table.
[0105] S6. Collect and encapsulate the leakage trend feature information recorded in the leakage trend judgment table to generate a leakage trend evidence package, and obtain memory leakage trend judgment information based on the leakage trend evidence package.
[0106] The judgment items in the leakage trend judgment table are broken down and collected, and the time interval information, interval correspondence information and source association information corresponding to each judgment item are extracted from the leakage trend judgment table to form an evidence list.
[0107] The specific process includes: expanding each judgment item in the leakage trend judgment table in order; breaking down the content recorded in each judgment item into sub-items; organizing content that can characterize the time range into time interval information; organizing content that can characterize the pairing relationship between the continuous growth interval and the residual rise interval into interval correspondence information; and organizing content that can characterize the continuous growth interval, residual rise interval, sliding window range, and release event range corresponding to the judgment source into source association information. This ensures that the time interval information, interval correspondence information, and source association information in the judgment item maintain a correspondence under the same item. After sub-item breakdown, the time interval information, interval correspondence information, and source association information corresponding to the same judgment item are collected and organized. All contents belonging to the same judgment item are written into the same evidence record, so that the time interval information can correspond to the interval correspondence information, the interval correspondence information can correspond to the source association information, and the source association information can point back to the corresponding judgment item. All evidence records are collected in order of judgment items to form an evidence list.
[0108] Based on the evidence list, the various types of evidence corresponding to the same judgment item are organized into a relationship to form a leakage trend evidence set corresponding to each judgment item.
[0109] The specific process includes: organizing various types of evidence content under the same judgment item according to the time interval information, interval correspondence information, and source association information corresponding to the evidence records in the evidence list; marking the relationship between time interval information and interval correspondence information; marking the directional relationship between interval correspondence information and source association information; grouping various types of evidence content with time association, interval association, and source association under the same judgment item according to the association relationship; forming an interconnected evidence relationship structure for all evidence content corresponding to the same judgment item; and organizing and compiling the evidence relationship structures corresponding to each judgment item to form a leakage trend evidence atlas corresponding to each judgment item.
[0110] The leakage trend evidence atlas is used to perform trusted encapsulation and summary solidification on each evidence graph to form a leakage trend evidence package.
[0111] The specific process includes processing each evidence graph in the leakage trend evidence graph set one by one, merging and organizing the time interval information, interval correspondence information, and source association information in the evidence graphs to ensure that the various types of evidence content in the same evidence graph remain corresponding, complete, and clearly related. The organized various types of evidence content are written into unified encapsulation content according to the evidence graph attribution relationship. The consistency of the evidence scope, evidence relationship, and evidence source in the unified encapsulation content is checked to ensure that all evidence graphs form a credible encapsulation structure with complete content and clear relationships. A summary is extracted from all evidence content in the credible encapsulation structure, and the summary content is fixed and recorded to maintain a one-to-one correspondence with the corresponding evidence graph, so that each evidence graph corresponds to a fixed summary content. After credible encapsulation and summary solidification, each evidence graph is collected according to the order of the judgment items, so that all credible encapsulation content and summary solidification content form a unified correspondence, forming a leakage trend evidence package.
[0112] Based on the encapsulation credibility, digest verification status, and interval correspondence in the leakage trend evidence package, memory leakage trend determination information is obtained.
[0113] The specific process includes: verifying each encapsulated content item by item based on the encapsulation credibility, digest verification status, and interval correspondence of each judgment item in the leakage trend evidence package; organizing the encapsulation credibility with the evidence support level of the corresponding judgment item; organizing the digest verification status with the content completeness of the corresponding judgment item; organizing the interval correspondence with the time interval information, interval correspondence information, and source association information of the corresponding judgment item; retaining judgment items with stable encapsulation credibility, consistent digest verification status, and clear interval correspondence; and differentiating and processing judgment items with insufficient encapsulation credibility, abnormal digest verification status, and unclear interval correspondence. Finally, the judgment content, time range, and evidence pointing relationship corresponding to each retained judgment item are collected in the order of the judgment items to obtain memory leak trend judgment information.
[0114] It should be noted that the encapsulation credibility refers to the result of quantitatively characterizing the reliability and acceptability of each piece of evidence in the leakage trend evidence package after collection and encapsulation; the summary verification status refers to the verification result obtained after verifying the summary content corresponding to each encapsulated content in the leakage trend evidence package; the interval correspondence refers to the effective correspondence information formed between the continuous growth interval and the residual increase interval in terms of time position, change order and change continuity.
[0115] In summary, this invention achieves hierarchical characterization and continuous tracking of memory growth processes at different time scales by determining window adaptive parameters and generating a multi-scale sliding window set through a basic memory analysis sequence. This enables the synchronous identification of slow leaks, local bursts, and phased fluctuations within a unified analysis chain. Furthermore, by identifying release event points, extracting post-release baseline values, and analyzing the correspondence between continuous growth intervals and residual increase intervals, this invention achieves joint determination of post-release baseline residue and continuous growth behavior. This improves the accuracy of memory leak trend identification, reduces false positives and false negatives, and enhances the traceability of determination information and its engineering application value.
[0116] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A memory leak trend analysis method based on window sliding detection of memory growth, characterized in that, include: Obtain memory usage records during the test process, and sort, deduplicate, and filter out anomalies from these records to form a basic memory analysis sequence; The window adaptation parameters are determined based on the basic memory analysis sequence, and a multi-scale sliding window set is generated using the window adaptation parameters. Calculate the window memory change characteristic values of each sliding window in the multi-scale sliding window set to form a multi-scale window feature table; Based on the multi-scale window feature table, local significant decline segments are identified to form a set of release event points. Pre-release analysis window and post-release analysis window are extracted according to each release event point, and the post-release baseline value is extracted from the post-release analysis window. A time-series comparison of the baseline values after release is performed to form a baseline residual feature set. The correspondence between the continuous growth interval and the residual increase interval is identified by combining the multi-scale window feature table to form a leakage trend determination table. The leakage trend feature information recorded in the leakage trend judgment table is collected and packaged to generate a leakage trend evidence package, and memory leakage trend judgment information is obtained based on the leakage trend evidence package.
2. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1, characterized in that, The specific steps for forming the basic memory analysis sequence are as follows: Obtain memory usage records during the test process, and extract sampling timestamps, object identifiers, and memory values from the memory usage records to form the original memory record set; The original memory record set is rewritten with a unified unit and sorted by time to obtain time-ordered records. The time-ordered records are then divided into time buckets and duplicates are removed to form a deduplicated ordered record set. The deduplicated ordered record set is subjected to anomaly filtering, and the deduplicated ordered record set after anomaly filtering is time-series organized to form a basic memory analysis sequence.
3. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 2, characterized in that, The specific steps for determining the window adaptive parameters based on the basic memory analysis sequence are as follows: The basic memory analysis sequence is divided into multiple continuous sampling segments according to the sampling continuity, and a scale candidate set corresponding to the sampling length is established to obtain the scale analysis sequence. The intensity of local variation at different scales of each sampling segment location is obtained from the scale analysis sequence, and a scale energy map is constructed. The scale energy map is used to perform front and back interval drift difference analysis on the location of each sampling segment to determine the span of the mother window corresponding to the location of each sampling segment; The span of the parent window is mapped hierarchically to obtain the parameters of the short-scale window, the medium-scale window, the long-scale window, and the sliding step size, forming a window adaptive parameter table.
4. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1, characterized in that, The specific steps for generating a multi-scale sliding window set using window adaptive parameters are as follows: The timeline is arranged according to the window parameters in the window adaptation parameter table to generate sliding windows of different scales; Based on sliding windows of different scales, overlapping and rearrangement are performed on adjacent windows at the same scale, and nesting and rearrangement are performed on windows at different scales to obtain a multi-scale sliding window set.
5. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1 or 4, characterized in that, The specific steps for forming the multi-scale window feature table are as follows: The sliding windows in the multi-scale sliding window set are standardized, and the trend reference information corresponding to each sliding window is extracted to form a trend reference group. Based on the trend reference group, path deviation analysis is performed on each sliding window to obtain the corresponding deviation amount. Then, the pullback depth, recovery closure and tail stability are extracted from the deviation amount to form a path structure description group. The trend reference group and the path structure description group are integrated to calculate the window memory change characteristic value of each sliding window, and then collected according to the window number and scale number to form a multi-scale window feature table.
6. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1, characterized in that, The specific steps for forming the set of release event points are as follows: Temporal and scale correlations are performed on the feature records of each window in the multi-scale window feature table, and cross-scale descent candidate chains are identified to determine locally significant descent segments. The locations of locally significant decline segments are refined to form a set of release event points.
7. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1 or 6, characterized in that, The specific steps for extracting the pre-release analysis window and the post-release analysis window based on each release event point, and extracting the post-release baseline value from the post-release analysis window, are as follows: A release window table is obtained by performing asymmetric pre- and post-capture windowing on each release event point in the release event point set. Based on the post-release analysis windows in the release window table, identify stable plateau segments with local slope convergence and limited fluctuation amplitude, and extract post-release baseline values from the stable plateau segments.
8. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 7, characterized in that, The specific steps for forming the baseline residual feature set are as follows: The baseline values after release are processed temporally and compared stepwise to identify residual change segments that gradually rise and are limited in local fallback, forming a baseline residual feature set. Based on the baseline residual feature set, the residual change segment is purified by interval extraction to obtain the residual elevation interval that maintains a continuous elevation state.
9. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1, characterized in that, The specific steps for forming the leakage trend determination table are as follows: A multi-scale window feature table is used to merge window feature records that have the same growth direction and are continuous in time to identify continuous growth intervals, and then a monotonic correspondence analysis is performed between the continuous growth intervals and the residual elevation intervals. Based on the information from monotonic correspondence analysis, the effective correspondence between the continuous growth interval and the residual increase interval is determined, and a leakage trend judgment table is formed according to the correspondence intensity and interval persistence.
10. The memory leak trend analysis method based on window sliding detection of memory growth as described in claim 1 or 9, characterized in that, The process of collecting and encapsulating the leakage trend feature information recorded in the leakage trend determination table to generate a leakage trend evidence package, and obtaining memory leakage trend determination information based on the leakage trend evidence package, is as follows: The judgment items in the leakage trend judgment table are broken down and collected, and the time interval information, interval correspondence information and source association information corresponding to each judgment item are extracted from the leakage trend judgment table to form an evidence list. Based on the evidence list, various types of evidence corresponding to the same judgment item are organized into a relationship set to form a leakage trend evidence atlas corresponding to each judgment item; The leakage trend evidence atlas is used to perform trusted encapsulation and digest solidification on each evidence graph to form a leakage trend evidence package; Based on the encapsulation credibility, digest verification status, and interval correspondence in the leakage trend evidence package, memory leakage trend determination information is obtained.