Memory recovery verification method and device, electronic equipment and storage medium

By acquiring memory allocation information, identifying unallocated and allocated regions, sending reclamation commands, and monitoring changes, the problem of the UVM platform's inability to accurately verify DUT memory management is solved, achieving accurate verification and anomaly identification of memory reclamation.

CN121166473APending Publication Date: 2025-12-19JINAN MAIWEI INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511422332.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

The UVM platform cannot accurately verify the memory management characteristics of the DUT, resulting in the inability to identify abnormal issues such as memory overflow and memory leak.

Method used

By obtaining the memory allocation information of the verification object, the unallocated and allocated memory regions are determined, memory reclamation instructions are sent, and the actual changes are monitored and compared with the ideal changes to determine the memory reclamation verification results.

Benefits of technology

It enables precise verification of the memory reclamation function of the verification object, and identifies and repairs memory overflow and leakage issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166473A_ABST
    Figure CN121166473A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a memory recovery verification method and device, electronic equipment and a storage medium. An unallocated memory area and an allocated memory area are determined according to acquired memory allocation information, and then a memory recovery instruction is sent to a verification object; the verification object performs memory recovery on the allocated memory region according to the memory recovery instruction, and performs memory recovery on the allocated memory region by comparing the actual change condition of the range determined by monitoring the unallocated memory region and the allocated memory region with the ideal change condition of the range of the unallocated memory region and the allocated memory region determined by the memory recovery instruction; and determining a memory recovery verification result of the verification object. Wherein if the actual range change condition is different from the ideal range change condition, it is determined that the verification object is abnormal in the memory recovery process, and if no difference exists, it is determined that the memory recovery function of the verification object is normal, and accurate verification of the memory recovery function of the verification object is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a memory recycling verification method and device, electronic equipment and storage medium. BACKGROUND

[0002] Universal Verification Methodology (UVM for short) provides a set of standard tools, components and processes for verifying the correctness of a Device Under Test (DUT for short), and the DUT determines different functions as verification objects according to different targets.

[0003] In related technologies, when verifying the memory management function of the DUT, the UVM does not have special verification capabilities adapted to the memory management characteristics of the DUT, which leads to inaccurate verification of the DUT, and the memory recycling function errors that may exist in the DUT itself cannot be identified, thereby causing abnormal problems such as memory overflow and memory leakage in the actual use of the DUT. SUMMARY

[0004] The present application provides a memory recycling verification method and device, electronic equipment and storage medium to at least solve the problem that the UVM platform cannot accurately verify the memory management characteristics of the DUT in related technologies.

[0005] The present application provides a memory recycling verification method, comprising: obtaining memory allocation information of a verification object; wherein the verification object is used for allocating and recycling memory; determining unallocated memory regions and allocated memory regions according to the memory allocation information; sending a memory recycling instruction to the verification object; monitoring the actual range change of the unallocated memory regions and the allocated memory regions in the process of the verification object recycling the memory of the allocated memory regions in response to the memory recycling instruction; determining ideal range change of the unallocated memory regions and the allocated memory regions according to the memory recycling instruction; determining a memory recycling verification result of the verification object according to the actual range change and the ideal range change of the unallocated memory regions and the allocated memory regions.

[0006] The present application also provides a memory recycling verification device, comprising: an obtaining module, configured to obtain memory allocation information of a verification object; wherein the verification object is used for allocating and recycling memory; The first determining module is configured to determine the unallocated memory region and the allocated memory region according to the memory allocation information; The sending module is configured to send the memory recovery instruction to the verification object; The monitoring module is configured to monitor actual range change of the unallocated memory region and the allocated memory region during the process that the verification object recovers the memory of the allocated memory region in response to the memory recovery instruction; The second determining module is configured to determine ideal range change of the unallocated memory region and the allocated memory region according to the memory recovery instruction; The verifying module is configured to determine a memory recovery verification result of the verification object according to the actual range change and the ideal range change.

[0007] The application further provides an electronic device, which comprises a memory configured to store a computer program and a processor configured to execute the computer program to implement the steps of any of the memory recovery verification methods.

[0008] The application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of any of the memory recovery verification methods.

[0009] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the steps of any of the memory recovery verification methods.

[0010] According to the application, the unallocated memory region and the allocated memory region are determined according to the obtained memory allocation information, then the memory recovery instruction is sent to the verification object, the verification object recovers the memory of the allocated memory region according to the memory recovery instruction, the actual range change of the unallocated memory region and the allocated memory region is determined by comparison, and the ideal range change of the unallocated memory region and the allocated memory region is determined according to the memory recovery instruction, so that the memory recovery verification result of the verification object is determined. If there is a difference between the actual range change and the ideal range change, it is determined that the verification object has an exception in the memory recovery process, if there is no difference, it is determined that the memory recovery function of the verification object is normal, and the accurate verification of the memory recovery function of the verification object is achieved. BRIEF DESCRIPTION OF DRAWINGS

[0011] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.

[0012] Figure 1 Structure diagram of a memory recycling verification system based on which the embodiments of the present application are implemented; Figure 2 Flow diagram of a memory recycling verification method provided by the embodiments of the present application; Figure 3 Structure diagram of an exemplary memory region allocation provided by the embodiments of the present application; Figure 4 Structure diagram of an exemplary memory management provided by the embodiments of the present application; Figure 5 Flow diagram of an exemplary memory recycling task splitting provided by the embodiments of the present application; Figure 6 Structure diagram of an exemplary memory region allocation provided by the embodiments of the present application; Figure 7 Structure diagram of an exemplary memory recycling verification platform provided by the embodiments of the present application; Figure 8 Structure diagram of a memory recycling verification apparatus provided by the embodiments of the present application; Figure 9 Structure diagram of an electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0013] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, any other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

[0014] It should be noted that, in the description of the present application, the terms “comprise”, “contain” or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. The terms “first”, “second” and the like in the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence.

[0015] UVM is a widely used verification methodology that provides a standardized framework and tools for verification engineers. In large-scale verification environments, the rational allocation and recycling of memory resources are crucial to the stability and performance of the verification platform. However, in actual verification processes, memory management problems remain a key bottleneck. UVM provides some basic memory management tools that allow verification engineers to allocate and manage memory space during verification. However, these tools still have limitations in memory allocation and recycling, especially in complex verification scenarios, which cannot fully test the real functions of the DUT, and the limitations of the DUT are also relatively large, so there are still problems of memory leakage and resource waste.

[0016] In related technologies, when verifying the memory management function of the DUT, UVM does not have a special verification capability that is adapted to the memory management characteristics of the DUT, which results in an inability to accurately verify the DUT, so that errors in the memory recycling function of the DUT itself cannot be identified, and thus abnormal problems such as memory overflow and memory leakage may occur during actual use of the DUT.

[0017] Embodiments of the present application provide a memory recycling verification method and device, electronic equipment and storage medium to solve the above technical problems. The method comprises: obtaining memory allocation information of a verification object; wherein the verification object is used for allocating and recycling memory; determining unallocated memory regions and allocated memory regions according to the memory allocation information; sending a memory recycling instruction to the verification object; monitoring the actual range change of the unallocated memory regions and the allocated memory regions during the process of the verification object recycling the allocated memory regions in response to the memory recycling instruction; determining the ideal range change of the unallocated memory regions and the allocated memory regions according to the memory recycling instruction; and determining the memory recycling verification result of the verification object according to the actual range change and the ideal range change of the unallocated memory regions and the allocated memory regions. The method provided by the above solution determines the unallocated memory regions and the allocated memory regions according to the obtained memory allocation information, then sends a memory recycling instruction to the verification object, and the verification object recycles the allocated memory regions according to the memory recycling instruction. The actual range change of the unallocated memory regions and the allocated memory regions is determined by comparing the actual range change of the unallocated memory regions and the allocated memory regions with the ideal range change of the unallocated memory regions and the allocated memory regions determined by the memory recycling instruction, and the memory recycling verification result of the verification object is determined. If there is a difference between the actual range change and the ideal range change, it is determined that the verification object has an abnormality in the memory recycling process, and if there is no difference, it is determined that the memory recycling function of the verification object is normal, thereby achieving accurate verification of the memory recycling function of the verification object.

[0018] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0019] The specific application environment architecture or specific hardware architecture on which the execution of the memory reclamation verification method depends is described here.

[0020] First, the structure of the memory reclamation verification system on which this application is based will be described: The memory reclamation verification method, apparatus, electronic device, and storage medium provided in this application are applicable to verifying the memory reclamation function of the verification object. Figure 1 The diagram shown is a structural schematic of the memory reclamation verification system based on the embodiments of this application. It mainly includes a verification object, a data acquisition device, and a memory reclamation verification device. The data acquisition device is used to acquire the memory allocation information of the verification object. Based on the obtained memory allocation information, the memory reclamation device determines the unallocated memory region and the allocated memory region, and sends a memory reclamation instruction to the verification object. Based on the actual and ideal changes in the range of the unallocated and allocated memory regions, the memory reclamation verification result of the verification object is determined.

[0021] This application provides a memory reclamation verification method for verifying the memory reclamation function of a verification object. The execution subject of this application is an electronic device, such as a server, desktop computer, laptop computer, tablet computer, and other electronic devices that can be used for memory reclamation verification.

[0022] like Figure 2 The diagram shown is a flowchart illustrating the memory reclamation verification method provided in this application embodiment. The method includes: Step 201: Obtain the memory allocation information of the verification object; wherein, the verification object is used for memory allocation and reclamation.

[0023] Specifically, the verification object, also known as the DUT, refers to the memory management module used to implement memory reclamation. This application embodiment verifies the memory allocation and reclamation function of the DUT. Depending on the application scenario, the memory allocation status of the verification object varies, and the memory allocation information includes the used memory status and the unused memory status.

[0024] Accordingly, by verifying the memory allocation of objects, the current memory usage and unused memory status are determined, providing data support for subsequent determination of used and unused memory regions.

[0025] Step 202: Determine the unallocated memory region and the allocated memory region based on the memory allocation information.

[0026] Specifically, based on the used and unused memory information represented by memory allocation information, allocated and unallocated memory regions are determined. These allocated and unallocated memory regions are address space mirrors, meaning they have the same address space structure, size, and partitioning. The start and end pointers (start_ptr and end_ptr) of the unallocated and allocated memory regions point to the head and tail of the memory space, respectively. The direction from the start pointer to the end pointer is the direction of pointer increment. Initially, both the head and tail pointers of the unallocated and allocated memory regions point to the start pointer. Memory blocks from the unallocated memory regions are virtually allocated to the allocated regions, and the head pointer of the unallocated memory region increments, as does the tail pointer of the allocated memory region.

[0027] For example, such as Figure 3 The diagram shown is an exemplary memory region allocation structure provided in this application embodiment. Initially, the head pointer (head_ptr) and tail pointer (tail_ptr) of both the unallocated memory region and the allocated memory region point to the start pointer. As memory blocks from the unallocated memory region are allocated to the used memory region, the head pointer of the unallocated memory region increases and gradually approaches the end pointer, while the tail pointer of the allocated memory region increases and gradually approaches the end pointer. When all memory blocks from the unallocated memory region are allocated to the used memory region, and no data has been reclaimed yet, head_ptr = end_ptr, and tail_ptr = start_ptr.

[0028] Accordingly, the range of the memory region is determined by the start pointer and the end pointer, and the memory allocation process is quantified by moving the head pointer and the tail pointer. Step 203: Send a memory reclamation command to the verification object.

[0029] Specifically, the memory reclamation instruction includes the instruction start address and the instruction reclamation length. The verification object selects the target data block of the allocated memory region for reclamation according to the memory reclamation instruction.

[0030] Accordingly, the location of the target memory to be reclaimed is represented by the memory reclamation instruction.

[0031] Step 204: During the process of verifying the object's response to the memory reclamation instruction to reclaim the allocated memory region, monitor the actual changes in the range of the unallocated memory region and the allocated memory region.

[0032] Specifically, the range actual change of the unallocated memory region and the allocated memory region is monitored by verifying the output interface of the object. The type of the output interface can be an interface of commonly used Advanced Peripheral Bus (APB), Advanced High-performance Bus (AHB) or Advanced eXtensible Interface (AXI), data monitoring is performed by using Verification Intellectual Property (VIP), or a self-defined interface, and a separate monitor needs to be defined. The object verifies the memory block of the allocated memory region according to the memory recycling instruction, the output interface obtains the information of the recycled target memory block, and the target data block information is the actual recycled memory block. At the same time, the number of memory blocks of the unallocated memory region increases, and the number of memory blocks of the allocated memory region decreases, and the output interface monitors the range actual change of the allocated memory region and the unallocated memory region.

[0033] Correspondingly, by monitoring the unallocated memory region and the allocated memory region, the actual target memory block of the object in the actual memory recycling process is obtained, and actual data is provided for subsequent determination of the memory recycling verification result of the object.

[0034] Step 205, according to the memory recycling instruction, determine the range ideal change of the unallocated memory region and the allocated memory region.

[0035] Specifically, the ideal target memory block is represented in the memory recycling instruction, and in the ideal state, the object correctly recycles the ideal target memory block from the allocated memory region to the unallocated memory region, the memory block corresponding to the allocated memory region decreases, and the memory block of the unallocated memory region increases, and the corresponding range ideal change is determined.

[0036] Correspondingly, the ideal memory block represented by the memory recycling instruction provides a theoretical reference for subsequent determination of the memory recycling verification result of the object.

[0037] Step 206, according to the range actual change and the range ideal change of the unallocated memory region and the allocated memory region, determine the memory recycling verification result of the object.

[0038] Specifically, when the range actual change and the range ideal change are different, it is determined that the actual recycled target memory block is a non-ideal recycled target memory block, that is, the object has an error in the memory recycling process, and the memory recycling verification result is abnormal. Abnormalities usually include memory overflow, memory leakage, etc.

[0039] Accordingly, by comparing the actual changes in the range with the ideal changes in the range, the memory reclamation verification result of the verification object was determined, and it was determined whether there were any abnormalities in the memory reclamation process of the verification object. The actual changes in the range and the ideal changes in the range detailed the situation of the target memory block and the situation of the unallocated memory area and the allocated memory area, thus achieving accurate verification of memory reclamation.

[0040] For example, such as Figure 4 The diagram shown is an exemplary memory management structure provided in this application embodiment. Memory management is divided into memory allocation and memory reclamation. The instruction for memory allocation is malloc, and the instruction for memory reclamation is mdealloc. During memory allocation, a verification object is used to move memory blocks from unallocated memory areas to allocated memory areas. During memory reclamation, a verification object is used to move memory blocks from allocated memory areas to unallocated memory areas. TB represents the memory management function of the verification object in an ideal state, yielding the memory management result under ideal conditions. DUT represents the memory management function of the verification object in a real-world situation, yielding the memory management result under real-world conditions.

[0041] Based on the above embodiments, as one implementable method, in one embodiment, sending a memory reclamation instruction to the verification object includes: Step 2031: Obtain the excitation signal randomly generated by the driver; wherein the excitation signal includes at least the memory reclamation start position and the memory reclamation length, and the excitation signal satisfies the preset memory reclamation constraints. Step 2031: Determine the memory reclamation task based on the stimulus signal; Step 2031: The memory reclamation task is split into multiple memory reclamation instructions and sent to the verification object.

[0042] Specifically, on the UVM verification platform, a randomly generated stimulus signal is driven into the DUT via a driver, according to the timing and signals of the DUT interface. The stimulus signal is a command input to the DUT, such as reclaiming a target memory block with a memory reclamation start position of 0x0000_1000 and a memory reclamation length of 0x100.

[0043] Specifically, the memory reclamation task is determined based on the content of the stimulus signal. Based on the specific memory reclamation task, it is broken down into multiple memory reclamation instructions (I / O instructions) and sent to the verification object to reclaim the target memory block. Specifically, the incentive signal includes a memory recovery start position, a memory recovery length, a preset memory recovery constraint condition, and whether to be concurrent or not. The concurrency refers to whether to execute the multiple memory recovery instructions split according to the incentive signal concurrently or not. The non-concurrency refers to completing one memory recovery instruction and then completing another memory recovery instruction. In the process of verifying the current memory recovery instruction, the allocated memory region and the unallocated memory region do not change except the position corresponding to the verification object. The incentive signal is determined as a class, and the multiple contents contained in the incentive signal are determined as multiple data types respectively. The multiple data types are contained in the incentive class, and the member variables of the incentive class related members can be increased or decreased according to the needs.

[0044] Specifically, the memory recovery start position and the memory recovery length of the incentive signal are randomly generated, but the incentive signal needs to meet the preset memory recovery constraint condition. The preset memory recovery constraint condition includes that the incentive signal needs to generate non-overlapping recovery regions, that is, the memory recovery start position (io_start[]) and the memory recovery length are random, but each non-repeating memory recovery start position is associated with the end position of the target memory block recovered in the previous step, that is, the memory recovery length of each target memory block needs to be between the next memory recovery start position and the current memory recovery start position. The memory recovery task is split into multiple memory recovery instructions, but the sum of the instruction recovery lengths corresponding to the multiple memory recovery instructions is equal to the memory recovery length in the incentive signal.

[0045] For example, as shown in Figure 5 Fig. 1 is a flowchart of an exemplary memory recovery task split provided by an embodiment of the present application. According to multiple incentive signals, multiple memory recovery tasks are determined. For any memory recovery task, it is split into multiple memory recovery instructions. Different memory recovery instructions correspond to different instruction start addresses, instruction recovery lengths, and memory recovery lengths corresponding to the memory recovery task.

[0046] Specifically, the split of the memory recovery task can be implemented by the following code: class my_transaction extends uvm_object; rand bit sync_flag; rand bit[31:0] io_num; rand bit[31:0] io_split_num[ ]; rand bit[31:0] io_start[ ]; rand bit[31:0] io_length[ ]; ……… constraint my_constr{ solve io_start before io_length; io_start.size ==io_split_num.sum( ); unique {io_start}; foreach(io_start[i]){ io_start[i] inside {[0:max_addr]}; io_length inside{[1:[io_start[i+1]-io_start[i]]]} } }; endclass Correspondingly, by the random generated excitation signal, the verification of the memory recycling function of the verification object has randomness, the memory recycling situations in various cases are contained in the multiple excitation signals, the memory recycling situation of the verification object in the extreme case is verified, and the comprehensiveness of the verification is improved.

[0047] On the basis of the above embodiment, as an implementable manner, in an embodiment, in the process that the verification object performs memory recycling on the allocated memory region in response to the memory recycling instruction, the actual range change of the unallocated memory region and the allocated memory region is monitored, including: Step 2041, in the process that the verification object performs memory recycling on the allocated memory region in response to the memory recycling instruction, the output interface of the verification object is monitored to obtain the actual change information of the pointers of the unallocated memory region and the allocated memory region; Step 2042, according to the actual change information of the pointers of the unallocated memory region and the allocated memory region, the actual range change of the unallocated memory region and the allocated memory region is determined.

[0048] Specifically, the verification object selects the corresponding memory block in the allocated memory region based on the instruction start address and instruction reclamation length represented by the memory reclamation instruction, and performs memory reclamation. During the memory reclamation process, the pointers to both the unallocated and allocated memory regions change. The verification object's output interface obtains the information of the reclaimed memory block and converts this information into actual pointer change information for the unallocated and allocated memory regions. Based on the actual pointer change information for the unallocated and allocated memory regions, the actual changes in the range of the unallocated and allocated memory regions are determined. These actual changes include the position changes of the head and tail pointers in each of the unallocated and allocated memory regions, the status of each target memory block being reclaimed, and the changes in the size of the unallocated and allocated memory regions.

[0049] Accordingly, the actual situation of the memory blocks reclaimed by the verification object was obtained through the output interface, providing data basis for subsequent judgment of the memory reclamation function of the verification object.

[0050] Specifically, in one embodiment, when the verification object reclaims the target memory block in the allocated memory region, the head pointer of the allocated memory region increases according to the number of target memory blocks, and the tail pointer of the unallocated memory region increases according to the number of target memory blocks.

[0051] For example, such as Figure 6 The diagram illustrates an exemplary memory region allocation structure provided in this embodiment. When all memory blocks in the unallocated memory region are allocated to the used memory region, and no data has yet been reclaimed, head_ptr = end_ptr, and tail_ptr = start_ptr. During memory reclamation, the head pointer of the allocated memory region increases according to the number of target memory blocks, gradually approaching the end pointer. The upper part of the current position pointed to by the head pointer of the allocated memory region represents the unreclaimed memory blocks in the allocated memory region, and the lower part represents the reclaimed memory blocks. Similarly, the tail pointer of the unallocated memory region increases according to the number of target memory blocks, gradually approaching the end pointer. The upper part of the current position pointed to by the tail pointer of the unallocated memory region represents the unreclaimed memory blocks, and the lower part represents the reclaimed memory blocks.

[0052] Based on the above embodiments, as an implementable approach, in one embodiment, the memory reclamation verification result of the verification object is determined according to the actual and ideal changes in the ranges of the unallocated and allocated memory regions, including: Step 2061: Determine the actual characteristic information of each target memory block reclaimed by the verification object based on the actual changes in the range of unallocated memory regions and allocated memory regions; Step 2062, determining the ideal characteristic information of each target memory block according to the ideal change of the range of the unallocated memory region and the allocated memory region; Step 2063, judging whether there is a difference between the actual characteristic information and the ideal characteristic information of each target memory block recycled by the verification object; Step 2064, in the case that there is a difference between the actual characteristic information and the ideal characteristic information of any target memory block recycled by the verification object, determining that the memory recycling verification result of the verification object is abnormal.

[0053] Specifically, the actual characteristic information of the target memory block includes the recycling start address and the recycling length of the recycled memory block, and the recycling start address and the recycling length of the recycled memory block in the actual recycling process are obtained by monitoring the output interface of the verification object. According to the memory recycling task generated by the excitation signal, the instruction start address and the instruction recycling length in the split memory recycling instruction are used as the ideal characteristic information of the target memory block to be recycled. The actual characteristic information and the ideal characteristic information of each target memory block recycled by the verification object are compared one by one to determine whether there is a difference between them. When there is a difference, the target memory block represented by the memory recycling instruction is not correctly recycled, and it is determined that the verification object has an error in the memory recycling process, that is, the memory recycling verification result is abnormal. When there is no difference, the target memory block represented by the memory recycling instruction is correctly recycled, and the corresponding pointer change of the unallocated memory region and the allocated memory region is also correct.

[0054] Correspondingly, by comparing the difference between the actual characteristic information and the ideal characteristic information of any target memory block, it is determined whether the target memory block recycled by the verification object is the target memory block represented by the memory recycling instruction, and whether the DUT has a recycling error.

[0055] Specifically, in an embodiment, the number of memory blocks after recycling of the unallocated memory region and the number of memory blocks after recycling of the allocated memory region can be determined according to the actual change of the range of the unallocated memory region and the allocated memory region; it is judged whether the cumulative value of the number of memory blocks after recycling of the unallocated memory region and the number of memory blocks after recycling of the allocated memory region is equal to the preset total memory amount; in the case that the cumulative value is not equal to the preset total memory amount, it is determined that the memory recycling verification result of the verification object is abnormal.

[0056] Specifically, the preset memory total amount is the total amount of the memory blocks when the unallocated memory region does not perform memory allocation, and is also the total amount of the memory blocks in the corresponding allocated memory region when all the memory blocks in the unallocated memory region complete memory allocation. Since the address space of the unallocated memory region and the allocated memory region is mirrored, the preset memory total amounts of the two are equal. After the recycling of the target memory block is completed, the number of the memory blocks in the unallocated memory region increases, and the number of the memory blocks in the allocated memory region decreases. Since the address space of the unallocated memory region and the allocated memory region is mirrored, the sum of the number of the memory blocks in the unallocated memory region and the number of the remaining memory blocks in the allocated memory region after recycling is equal to the preset memory total amount.

[0057] Specifically, when the sum is greater than the preset memory total amount, it indicates that the verification object recycles the memory blocks in the unallocated memory region, i.e., the external memory blocks, to the unallocated memory region, and at this time, the memory recycling is abnormal, and it is determined that the memory recycling verification result of the verification object is abnormal, and at this time, memory overflow occurs. When the sum is less than the preset memory total amount, it indicates that the target memory block recycled by the verification object in the allocated memory region is lost and is not recycled to the unallocated memory region, and at this time, the memory recycling is abnormal, and it is determined that the memory recycling verification result of the verification object is abnormal, and at this time, memory leakage occurs.

[0058] Correspondingly, by comparing the sum with the preset memory total amount, it is determined whether the verification object has recycling error or loss of the target memory block in the memory recycling process, and whether the verification object has memory overflow and memory leakage.

[0059] Specifically, in an embodiment, in the process that the verification object performs memory recycling on the allocated memory region in response to the memory recycling instruction, the reserved memory block in the allocated memory region that does not need to be recycled is monitored to verify whether the reserved memory block has error recycling. In the case that the reserved memory block has error recycling, it is determined that the memory recycling verification result of the verification object is abnormal.

[0060] Specifically, in the case that the memory recycling instruction is not multi-instruction concurrent execution, the reserved memory block in the allocated memory region that does not need to be recycled is monitored to monitor whether the reserved memory block that does not need to be recycled is recycled by error. When the reserved memory block is recycled by error, the memory recycling of the verification object is misaligned, i.e., the memory recycling verification result of the verification object is abnormal.

[0061] Correspondingly, by monitoring the reserved memory block in the allocated memory region that does not need to be recycled, it is monitored whether the verification object has recycling error of the target memory block, and it is verified whether the memory recycling of the verification object is accurate.

[0062] For example, the memory recycling instruction is a memory recycling instruction of a memory management unit (MMU) of a computer system. Figure 7As shown, the structure schematic diagram of the exemplary memory recycling verification platform provided by the embodiment of the present application is shown. In the UVM verification platform, the driver analyzes the randomly generated excitation signal, determines the memory recycling task, and splits the memory recycling task into a plurality of memory recycling instructions, the memory recycling instructions including the instruction start address, the instruction recycling length, and the memory recycling length. According to the timing and signal of the DUT interface, the driver is driven into the DUT. The DUT recycles the target memory block according to the memory recycling instruction. The data change of the output interface of the verification object is monitored by the monitor to obtain the actual change condition of the range. The data change of the output interface of the verification object can also be monitored by the self-defined monitor to obtain the actual change condition of the range. Meanwhile, the reference model is used to collect the data packet sent by the driver to obtain the ideal change condition of the range. Finally, the ideal change condition of the range and the actual change condition of the range are input into the checker. In the checker, whether the recycled target memory block is correct and whether the cumulative value of the recycled memory block quantity of the unallocated memory area and the recycled memory block quantity of the allocated memory area after recycling is equal to the preset total memory quantity are checked. Whether the verification object is abnormal in the memory recycling process is judged to obtain the memory recycling verification result.

[0063] Specifically, in an embodiment, when the verification platform determines that the memory recycling verification result of the verification object is abnormal, first, the scene is saved, and the related information at the time of error is recorded, for example, the current memory recycling instruction, the target memory block information obtained by the output interface, the pointer condition of the unallocated memory area and the allocated memory area, etc. The verification platform analyzes the related information at the time of error, compares the ideal change condition of the range and the actual change condition of the range, and provides the user with an accurate error analysis report and an abnormality repair suggestion.

[0064] The memory recovery verification method provided by the embodiments of the present application comprises: obtaining memory allocation information of a verification object; wherein the verification object is used for memory allocation and recovery; determining unallocated memory regions and allocated memory regions according to the memory allocation information; sending a memory recovery instruction to the verification object; monitoring actual range change of the unallocated memory regions and the allocated memory regions in a process in which the verification object performs memory recovery on the allocated memory regions in response to the memory recovery instruction; determining ideal range change of the unallocated memory regions and the allocated memory regions according to the memory recovery instruction; and determining a memory recovery verification result of the verification object according to the actual range change and the ideal range change of the unallocated memory regions and the allocated memory regions. The method provided by the above scheme determines the unallocated memory regions and the allocated memory regions according to the obtained memory allocation information, then sends the memory recovery instruction to the verification object, and the verification object performs memory recovery on the allocated memory regions according to the memory recovery instruction, and the actual range change of the unallocated memory regions and the allocated memory regions is determined by comparison, and the ideal range change of the unallocated memory regions and the allocated memory regions determined according to the memory recovery instruction, so as to determine the memory recovery verification result of the verification object. If there is a difference between the actual range change and the ideal range change, it is determined that the verification object has an abnormality in the memory recovery process, if there is no difference, it is determined that the memory recovery function of the verification object is normal, and accurate verification of the memory recovery function of the verification object is achieved.

[0065] And, by verifying the memory allocation of the object, the current memory usage and unused memory situation is determined, providing data support for subsequent determination of used memory area and unused memory area. The range of the memory area is determined by the start pointer and the end pointer, and the memory allocation process is quantified by the movement of the head pointer and the tail pointer. The location of the target memory to be recycled is represented by the memory recycling instruction. By monitoring the unallocated memory area and the allocated memory area, the actual situation of the target memory block in the actual memory recycling process of the verification object is obtained, providing actual data for subsequent determination of the memory recycling verification result of the verification object. The ideal memory block situation represented by the memory recycling instruction provides a theoretical reference for subsequent determination of the memory recycling verification result of the verification object. By comparing the actual range change and the ideal range change, the memory recycling verification result of the verification object is determined, and whether the verification object has an abnormality in the memory recycling process is judged. The actual range change and the ideal range change reflect the situation of the target memory block and the situation of the unallocated memory area and the allocated memory area in detail, achieving accurate verification of memory recycling. The random excitation signal makes the verification of the memory recycling function of the verification object random, and the memory recycling situation in various cases is included in the multiple excitation signals, verifying the memory recycling situation of the verification object in extreme cases, and improving the comprehensiveness of the verification. The actual situation of the memory block recycled by the verification object is obtained through the output interface, providing a data basis for subsequent judgment of the memory recycling function of the verification object. By comparing the difference between the actual characteristic information and the ideal characteristic information of any target memory block, it is judged whether the target memory block recycled by the verification object is the target memory block represented by the memory recycling instruction, and whether the DUT has a recycling error. By comparing the accumulated value and the preset total memory amount, it is judged whether there is a recycling error or a recycling loss of the target memory block in the memory recycling process of the verification object, and whether the verification object has a memory overflow and a memory leak. By monitoring the reserved memory block in the allocated memory area that does not need to be recycled, it is monitored whether the verification object has a target memory block recycling error, and whether the memory recycling of the verification object is accurate.

[0066] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment.

[0067] The embodiments of the present application also provide a memory recycling verification device for executing the memory recycling verification method provided by the above embodiments.

[0068] As Figure 8As shown in the figure, it is a structural schematic diagram of the memory recovery verification device provided by the embodiment of the present application. The memory recovery verification device 80 comprises an obtaining module 801, a first determining module 802, a sending module 803, a monitoring module 804, a second determining module 805 and a verification module 806.

[0069] The obtaining module is configured to obtain memory allocation information of a verification object, wherein the verification object is configured to perform memory allocation and recovery. The first determining module is configured to determine unallocated memory regions and allocated memory regions according to the memory allocation information. The sending module is configured to send a memory recovery instruction to the verification object. The monitoring module is configured to monitor actual range variation of the unallocated memory regions and the allocated memory regions in a process in which the verification object performs memory recovery on the allocated memory regions in response to the memory recovery instruction. The second determining module is configured to determine ideal range variation of the unallocated memory regions and the allocated memory regions according to the memory recovery instruction. The verification module is configured to determine a memory recovery verification result of the verification object according to the actual range variation and the ideal range variation of the unallocated memory regions and the allocated memory regions.

[0070] The features of the embodiments of the memory recovery verification device can be referred to the related descriptions of the embodiments of the memory recovery verification method, which will not be repeated here.

[0071] The embodiments of the present application further provide an electronic device, as shown in the figure, which comprises a processor 10 and a memory 20. The memory 20 stores a computer program. The processor 10 is configured to run the computer program to perform the steps in any of the above memory recovery verification method embodiments. Figure 9 As shown in the figure, it is a structural schematic diagram of the electronic device provided by the embodiment of the present application, which comprises a processor 10 and a memory 20. The memory 20 stores a computer program. The processor 10 is configured to run the computer program to perform the steps in any of the above memory recovery verification method embodiments.

[0072] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is configured to perform the steps in any of the above memory recovery verification method embodiments when running.

[0073] In an example embodiment, the above computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk and various media that can store computer programs.

[0074] The embodiments of the present application further provide a computer program product, which comprises a computer program. The computer program is executed by a processor to perform the steps in any of the above memory recovery verification method embodiments.

[0075] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described memory reclamation verification method embodiments.

[0076] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0077] The foregoing has provided a detailed description of a memory reclamation verification method, apparatus, electronic device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to aid in understanding the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A memory reclamation verification method, characterized in that, include: Obtain the memory allocation information of the verification object; wherein the verification object is used for memory allocation and reclamation; Based on the memory allocation information, the unallocated memory region and the allocated memory region are determined; Send a memory reclamation command to the verification object; During the process of the verification object reclaiming the allocated memory region in response to the memory reclamation instruction, the actual changes in the range of the unallocated memory region and the allocated memory region are monitored. Based on the memory reclamation instruction, determine the ideal changes in the range of the unallocated memory region and the allocated memory region; The memory reclamation verification result of the verification object is determined based on the actual and ideal changes in the ranges of the unallocated and allocated memory regions.

2. The memory reclamation verification method according to claim 1, characterized in that, Sending a memory reclamation instruction to the verification object includes: Obtain a randomly generated excitation signal from the driver; wherein the excitation signal includes at least the memory reclamation start position and the memory reclamation length, and the excitation signal satisfies a preset memory reclamation constraint condition; The memory reclamation task is determined based on the stimulus signal; The memory reclamation task is split into multiple memory reclamation instructions, which are then sent to the verification object.

3. The memory reclamation verification method according to claim 1, characterized in that, The process of monitoring the actual changes in the range of the unallocated memory region and the allocated memory region during the process of the verification object reclaiming the allocated memory region in response to the memory reclamation instruction includes: During the process of the verification object reclaiming the allocated memory region in response to the memory reclamation instruction, the output interface of the verification object is monitored to obtain the actual change information of the pointers of the unallocated memory region and the allocated memory region; Based on the actual changes in the pointers to the unallocated memory region and the allocated memory region, determine the actual changes in the range of the unallocated memory region and the allocated memory region.

4. The memory reclamation verification method according to claim 3, characterized in that, When the verification object reclaims the target memory block in the allocated memory region, the head pointer of the allocated memory region increases according to the number of target memory blocks, and the tail pointer of the unallocated memory region increases according to the number of target memory blocks.

5. The memory reclamation verification method according to claim 1, characterized in that, The step of determining the memory reclamation verification result of the verification object based on the actual and ideal changes in the ranges of the unallocated and allocated memory regions includes: Based on the actual changes in the range of the unallocated memory region and the allocated memory region, determine the actual characteristic information of each target memory block reclaimed by the verification object; Based on the ideal variation of the ranges of the unallocated memory region and the allocated memory region, determine the ideal feature information of each target memory block; Determine whether there is a difference between the actual feature information and the ideal feature information of each target memory block reclaimed by the verification object; If there is a difference between the actual characteristic information and the ideal characteristic information of any of the target memory blocks reclaimed by the verification object, the memory reclamation verification result of the verification object is determined to be abnormal.

6. The memory reclamation verification method according to claim 1, characterized in that, The method further includes: Based on the actual changes in the range of the unallocated memory region and the allocated memory region, determine the number of memory blocks after reclamation in the unallocated memory region and the number of memory blocks after reclamation in the allocated memory region; Determine whether the sum of the number of memory blocks after reclamation in the unallocated memory region and the number of memory blocks after reclamation in the allocated memory region is equal to the preset total memory. If the accumulated value is not equal to the preset total memory, the memory reclamation verification result of the verification object is determined to be abnormal.

7. The memory reclamation verification method according to claim 1, characterized in that, The method further includes: During the process of the verification object reclaiming the allocated memory region in response to the memory reclamation instruction, the reserved memory blocks that do not need to be reclaimed in the allocated memory region are monitored to verify whether the reserved memory blocks have been erroneously reclaimed. In the event of erroneous reclamation of the reserved memory block, the memory reclamation verification result of the verification object is determined to be abnormal.

8. A memory reclamation verification device, characterized in that, include: An acquisition module is used to acquire memory allocation information of a verification object; wherein the verification object is used for memory allocation and reclamation. The first determining module is used to determine the unallocated memory region and the allocated memory region based on the memory allocation information. The sending module is used to send a memory reclamation command to the verification object; The monitoring module is used to monitor the actual changes in the range of the unallocated memory region and the allocated memory region during the process when the verification object reclaims the allocated memory region in response to the memory reclamation instruction; The second determining module is used to determine the ideal range changes of the unallocated memory region and the allocated memory region according to the memory reclamation instruction; The verification module is used to determine the memory reclamation verification result of the verification object based on the actual and ideal changes in the ranges of the unallocated and allocated memory regions.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the memory reclamation verification method as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the memory reclamation verification method as described in any one of claims 1 to 7.