Vehicle-mounted application memory occupation detection method and device, equipment and storage medium
By splitting in-vehicle applications into components and recording test scripts, and using memory analysis tools to perform stress testing, the automation and stability issues of in-vehicle application memory usage detection are solved, ensuring the normal operation of the memory of in-vehicle devices in complex environments.
Patent Information
- Application Number
- CN202510757796.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-09-26
AI Technical Summary
Existing in-vehicle application memory usage detection technology lacks automated testing, the test results are not intuitive, and the acceptance criteria are unclear, making it impossible to ensure the memory stability and anomalies of in-vehicle equipment under high-intensity and long-term use.
Split the in-vehicle application into multiple components, use the preset script recording tool to record the test script, perform stress testing using the memory analysis tool and memory indicator script, compare the memory snapshot file and memory indicators with the standard, and determine whether the memory usage is abnormal.
It realizes the memory usage detection of vehicle-mounted applications during high-frequency, high-intensity and long-term use, ensuring the memory stability of vehicle-mounted devices, avoiding memory leaks and jitters, and meeting user needs.
Smart Images

Figure CN120704923A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle-mounted software technology, and in particular, to a method, apparatus, computer equipment, and storage medium for detecting vehicle-mounted application memory usage. Background Art
[0002] Currently, in-vehicle applications are software programs that run in the vehicle's electronic system. Examples include in-vehicle navigation, in-vehicle entertainment systems (such as music and video playback software), and vehicle monitoring and diagnostic software. These in-vehicle applications have their own specific usage scenarios and requirements. For example, while the vehicle is driving, users may turn on or off certain in-vehicle applications at any time and expect these applications to respond quickly to operational instructions. Research on the memory usage of in-vehicle applications is mainly aimed at enabling in-vehicle applications to better adapt to the in-vehicle environment. The in-vehicle environment has some particularities. For example, the mobility of the vehicle may lead to unstable network signals, the resources of the in-vehicle system (such as CPU, memory, storage, etc.) are relatively limited, and the vehicle's electronic system may be affected by environmental factors such as temperature and vibration.
[0003] Existing technology for detecting memory usage of in-vehicle applications relies on self-testing by development engineers and testing by test engineers. The testing process cannot be automated, the test results are not intuitive enough, the acceptance criteria after the test is completed are not clear, and there is a lack of high-intensity and long-term testing. It is unknown whether it can meet the standards for in-vehicle equipment. Summary of the Invention
[0004] The embodiments of the present application provide a method, apparatus, computer device, and storage medium for detecting memory usage of in-vehicle applications.
[0005] A first aspect of an embodiment of the present application provides a method for detecting memory usage of an in-vehicle application, comprising:
[0006] Split the in-vehicle application to be tested into multiple components;
[0007] For each component, use the preset script recording tool to record the test script of the current component;
[0008] Based on the preset memory analysis tools and memory indicator scripts, stress test the current component according to the current component's test script;
[0009] Based on the preset memory usage samples and memory usage standards, determine whether the memory usage of the in-vehicle application to be tested is abnormal according to the memory snapshot file and memory indicators obtained by the stress test.
[0010] In an optional embodiment of the present application, splitting the in-vehicle application to be detected into multiple components includes:
[0011] According to the functions of the components, the in-vehicle application to be tested is split into at least two components among a login component, a video playback component, and a waterfall flow component.
[0012] In an optional embodiment of the present application, recording the test script of the current component using a preset script recording tool includes:
[0013] Use the preset script recording tool to record the operation actions on the current component;
[0014] Convert the current component's operation actions into test scripts;
[0015] A test script whose strength and frequency meet preset conditions is selected from multiple test scripts as the test script for performing stress testing on the current component.
[0016] In an optional embodiment of the present application, the stress test of the current component based on the preset memory analysis tool and memory indicator script according to the test script of the current component includes:
[0017] During the stress test of the current component according to the test script of the current component, a preset memory analysis tool is used to obtain a memory snapshot file in the stress test, and a memory indicator script is used to record the memory indicators of the current component in real time.
[0018] In an optional embodiment of the present application, the determining whether the memory usage of the in-vehicle application to be tested is abnormal based on the preset memory usage sample and memory usage standard and the memory snapshot file and memory indicators obtained by the stress test includes:
[0019] Compare the memory snapshot file obtained from the stress test with the preset memory usage sample;
[0020] If the comparison result shows that the memory usage of the current component of the in-vehicle application to be tested is abnormal, the memory indicator obtained from the stress test is compared with the preset memory usage standard;
[0021] When the memory indicator of the current component does not meet the preset memory usage standard, it is determined that the memory usage of the current component and the current in-vehicle application to be detected is abnormal.
[0022] In an optional embodiment of the present application, the memory indicator obtained according to the stress test is compared with a preset memory usage standard, including:
[0023] Generate a memory change waveform chart during the stress test period based on the memory indicators obtained during the stress test, wherein the memory change waveform chart is a waveform chart showing changes in memory usage over time;
[0024] The maximum memory usage value is read from the memory change waveform and compared with the maximum memory usage threshold in the preset memory usage standard. If the maximum memory usage value exceeds the maximum memory usage threshold, it is determined that the memory indicator of the current component does not meet the preset memory usage standard.
[0025] The memory change state is read from the memory change waveform. If the memory keeps increasing, it is determined that the memory indicator of the current component does not meet the preset memory usage standard.
[0026] In an optional embodiment of the present application, the preset memory analysis tool is developed in an application integrated development environment, and the memory indicator script is developed through a command line tool.
[0027] A second aspect of an embodiment of the present application provides a device for detecting memory usage of an in-vehicle application, comprising:
[0028] A splitting module is used to split the in-vehicle application to be tested into multiple components;
[0029] The recording module is used to record the test script of the current component using a preset script recording tool for each component;
[0030] The test module is used to perform stress testing on the current component based on the preset memory analysis tools and memory indicator scripts according to the current component's test script;
[0031] The determination module is used to determine whether the memory usage of the vehicle application to be tested is abnormal based on the preset memory usage sample and memory usage standard and the memory snapshot file and memory indicators obtained by the stress test.
[0032] A third aspect of an embodiment of the present application provides a computer device comprising: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any of the above methods for detecting the memory occupancy of an in-vehicle application are implemented.
[0033] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for detecting the memory occupancy of an in-vehicle application as described in any one of the above items are implemented.
[0034] The above technical solutions provided by the embodiments of the present application have at least some or all of the following advantages compared to the prior art:
[0035] The method for detecting the memory usage of an in-vehicle application described in an embodiment of the present application divides the in-vehicle application to be detected into multiple components; for each component, a preset script recording tool is used to record the test script of the current component; based on a preset memory analysis tool and memory indicator script, the current component is stress tested according to the test script of the current component; based on the preset memory usage sample and memory usage standard, it is determined whether the memory usage of the in-vehicle application to be detected is abnormal according to the memory snapshot file and memory indicators obtained by the stress test. By detecting whether the memory usage of the in-vehicle application meets the standards of the in-vehicle equipment during high-frequency, high-intensity and long-term use, and whether there are abnormal conditions of memory leakage and memory jitter, it is ensured that the in-vehicle application remains running in a complex environment, or is paused and resumed at an appropriate time to meet user needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 A flowchart of a method for detecting in-vehicle application memory usage provided by one embodiment of the present application;
[0038] Figure 2 A flowchart of a method for detecting memory usage of an in-vehicle application provided in another embodiment of the present application;
[0039] Figure 3 A schematic diagram of high-intensity and high-frequency stress test results provided by one embodiment of the present application;
[0040] Figure 4 A memory change waveform diagram provided for one embodiment of the present application;
[0041] Figure 5 A memory change waveform diagram provided for another embodiment of the present application;
[0042] Figure 6 A schematic diagram of the structure of a device for detecting memory usage of in-vehicle applications provided in one embodiment of the present application;
[0043] Figure 7 A schematic diagram of the computer device structure provided for one embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the technical solutions and advantages of the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, and are not an exhaustive list of all the embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other unless they conflict.
[0045] See Figure 1 and Figure 2 The method for detecting the memory usage of an in-vehicle application provided in an embodiment of the present application includes the following steps S100 to S400:
[0046] S100, splits the in-vehicle application to be tested into multiple components;
[0047] S200, for each component, using a preset script recording tool to record a test script for the current component;
[0048] S300, based on the preset memory analysis tools and memory indicator scripts, performs stress testing on the current component according to the current component's test script;
[0049] S400 , based on a preset memory usage sample and memory usage standard, and according to the memory snapshot file and memory indicators obtained by the stress test, determines whether the memory usage of the in-vehicle application to be tested is abnormal.
[0050] In an optional embodiment of the present application, the method further includes:
[0051] In the case that the memory usage of the in-vehicle application to be detected is abnormal, the component with the abnormal memory usage in the in-vehicle application to be detected is optimized so that the memory usage of each component in the in-vehicle application to be detected is normal.
[0052] The method for detecting the memory usage of in-vehicle applications in the present application, and the residence of in-vehicle applications benefit from the current development progress of the car-machine system. Major manufacturers have installed voice assistants. In order for in-vehicle applications to interact with voice assistants, they need to register foreground services to ensure that they can interact with the applications through voice after being awakened, which largely avoids the probability of applications being recycled. Since the current manufacturers' car-machine systems are highly customized, many car-machines do not have the concept of manually closing applications. In-vehicle applications are at risk of being recycled if they are not used in the background for a long time. Therefore, the car machine has very strict memory management for in-vehicle applications. The method for detecting the memory usage of in-vehicle applications in the present application can detect whether the memory of the in-vehicle application is stable under high-frequency and long-term use, and whether there are problems of memory leakage and memory jitter.
[0053] In an optional embodiment of the present application, in step S100, splitting the in-vehicle application to be detected into multiple components includes:
[0054] According to the functions of the components, the in-vehicle application to be tested is split into at least two components among a login component, a video playback component, and a waterfall flow component.
[0055] In an optional embodiment of the present application, in step S200, recording the test script of the current component using a preset script recording tool includes:
[0056] Use the preset script recording tool to record the operation actions on the current component;
[0057] Convert the current component's operation actions into test scripts;
[0058] A test script whose strength and frequency meet preset conditions is selected from multiple test scripts as the test script for performing stress testing on the current component.
[0059] The method for detecting the memory usage of vehicle applications in this application obtains a test script for high-frequency and high-intensity testing of components, which can realize high-intensity and high-frequency stress testing of each component, such as Figure 3 As shown, the subscriber was detected 143 times during the stress test, which is much higher than the normal usage scenario.
[0060] In an optional embodiment of the present application, in step S300, the stress test of the current component is performed based on the preset memory analysis tool and memory indicator script according to the test script of the current component, including:
[0061] During the stress test of the current component according to the test script of the current component, a preset memory analysis tool is used to obtain a memory snapshot file in the stress test, and a memory indicator script is used to record the memory indicators of the current component in real time.
[0062] In an optional embodiment of the present application, in step S400, determining whether the memory usage of the in-vehicle application to be tested is abnormal based on the preset memory usage sample and memory usage standard and the memory snapshot file and memory indicators obtained by the stress test includes:
[0063] Compare the memory snapshot file obtained from the stress test with the preset memory usage sample;
[0064] If the comparison result shows that the memory usage of the current component of the in-vehicle application to be tested is abnormal, the memory indicator obtained from the stress test is compared with the preset memory usage standard;
[0065] When the memory indicator of the current component does not meet the preset memory usage standard, it is determined that the memory usage of the current component and the current in-vehicle application to be detected is abnormal.
[0066] In an optional embodiment of the present application, the memory indicator obtained according to the stress test is compared with a preset memory usage standard, including:
[0067] Generate a memory change waveform chart during the stress test period based on the memory indicators obtained during the stress test, wherein the memory change waveform chart is a waveform chart showing changes in memory usage over time;
[0068] The maximum memory usage value is read from the memory change waveform and compared with the maximum memory usage threshold in the preset memory usage standard. If the maximum memory usage value exceeds the maximum memory usage threshold, it is determined that the memory indicator of the current component does not meet the preset memory usage standard.
[0069] The memory change state is read from the memory change waveform. If the memory keeps increasing, it is determined that the memory indicator of the current component does not meet the preset memory usage standard.
[0070] See also Figure 4 During the entire stress test, the maximum memory usage does not exceed 650M. The vehicle-mounted device requires that the memory usage during use should not exceed 10% or 20% of the vehicle-mounted device memory. According to the memory indicators of different manufacturers and vehicle-mounted devices that need to be put on the shelves, it can be determined whether the memory change of this stress test can reach the upper limit standard of the vehicle-mounted device.
[0071] See also Figure 5 During this stress test, the memory usage has been growing, and there are obvious problems with memory recovery. The curve reaches a maximum of 1000M, which is far higher than the memory limit of the vehicle-mounted device and does not meet the online standards of the vehicle-mounted device. Therefore, the memory indicators of the current vehicle-mounted applications do not meet the preset memory usage standards.
[0072] In an optional embodiment of the present application, the preset memory analysis tool is developed in an application integrated development environment, and the memory indicator script is developed through a command line tool.
[0073] In an optional embodiment of the present application, the application process of the method for detecting the memory usage of an in-vehicle application of the present application includes:
[0074] First, after obtaining the in-vehicle application to be tested, split the in-vehicle application to be tested into components for testing, such as login component, video playback component, waterfall flow component, etc. According to the component content, use the preset script recording tool to record the test script of each component.
[0075] Second, prepare the stress testing environment: Use the Memory Profiler tool (Memory Profiler is a memory performance analysis tool built into Android Studio, designed for monitoring and optimizing Android application memory usage. It supports real-time tracking of memory allocation, heap memory snapshots, and garbage collection behavior, helping developers locate key issues such as memory leaks and memory jitter) to monitor memory leaks and memory usage of each component; use the memory indicator script developed specifically for dumpsys meminfo (dumpsys meminfo is a command-line tool built into the Android system for in-depth analysis of device memory usage) to record the memory indicators of the current test device in real time during the stress testing process.
[0076] Third, use the test script generated in the first step to start stress testing for each component. During the stress test, open the Memory Profiler and memory indicator script at the same time.
[0077] Fourth, after the stress test, use the Memory Profiler to export the hprof file (HPROF file is a binary heap dump file that records the type, number, and reference relationships of all objects in the heap memory of the application at a certain moment, and can fully reflect the memory allocation status). Based on the preset memory usage samples, analyze all memory usage indicators of the in-vehicle application to see whether any memory usage indicators exceed the standard.
[0078] The method for detecting memory usage of in-vehicle applications in this application addresses the technical problems that traditional memory usage detection relies on engineers' self-detection, lacks high-intensity and high-frequency stress testing, and has no memory usage optimization standards. By providing a script recording tool to record scripts that can be used for high-intensity and high-frequency stress testing, high-intensity and high-frequency stress testing can be provided for each component of the in-vehicle application.
[0079] This application also provides a memory usage sample library and memory indicator standards. By comparing the test results with the samples in the memory usage sample library, components with abnormally high memory usage can be found. Based on the stress test results, a memory change waveform can be drawn and compared with the upper limit standard of the memory indicator standard to determine whether the memory usage of the in-vehicle application meets the upper limit standard.
[0080] It should be understood that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0081] See Figure 6 One embodiment of the present application provides a device 600 for detecting memory usage of an in-vehicle application, including:
[0082] A splitting module 610 is used to split the in-vehicle application to be detected into multiple components;
[0083] The recording module 620 is used to record the test script of each component using a preset script recording tool;
[0084] The testing module 630 is used to perform stress testing on the current component according to the test script of the current component based on the preset memory analysis tool and memory indicator script;
[0085] The determination module 640 is configured to determine whether the memory usage of the in-vehicle application to be tested is abnormal based on a preset memory usage sample and memory usage standard and according to the memory snapshot file and memory indicators obtained by the stress test.
[0086] For the specific limitations of the above-mentioned device 600, please refer to the limitations of the method for detecting the memory usage of in-vehicle applications above, and will not be repeated here. The various modules in the above-mentioned device 600 can be implemented in whole or in part through software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor of the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.
[0087] In one embodiment, a computer device is provided. The internal structure diagram of the computer device can be as follows: Figure 7As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a method for detecting the memory occupancy of an in-vehicle application as described above. It includes: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, it implements any step in the method for detecting the memory occupancy of an in-vehicle application as described above.
[0088] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above-mentioned method for detecting the memory usage of an in-vehicle application can be implemented.
[0089] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0090] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0093] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0094] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A method for detecting memory usage of vehicle-mounted applications, characterized in that: include: Split the in-vehicle application to be tested into multiple components; For each component, use the preset script recording tool to record the test script of the current component; Based on the preset memory analysis tools and memory indicator scripts, stress test the current component according to the current component's test script; Based on the preset memory usage samples and memory usage standards, determine whether the memory usage of the in-vehicle application to be tested is abnormal according to the memory snapshot file and memory indicators obtained by the stress test.
2. The method according to claim 1, characterized in that The in-vehicle application to be tested is divided into multiple components, including: According to the functions of the components, the in-vehicle application to be tested is split into at least two components among a login component, a video playback component, and a waterfall flow component.
3. The method according to claim 1, characterized in that The method of recording the test script of the current component by using a preset script recording tool includes: Use the preset script recording tool to record the operation actions on the current component; Convert the current component's operation actions into test scripts; A test script whose strength and frequency meet preset conditions is selected from multiple test scripts as the test script for performing stress testing on the current component.
4. The method according to claim 1, wherein The stress test is performed on the current component based on the preset memory analysis tool and memory indicator script according to the current component test script, including: During the stress test of the current component according to the test script of the current component, a preset memory analysis tool is used to obtain a memory snapshot file in the stress test, and a memory indicator script is used to record the memory indicators of the current component in real time.
5. The method according to claim 4, characterized in that The method of determining whether the memory usage of the in-vehicle application to be tested is abnormal based on the preset memory usage sample and memory usage standard and the memory snapshot file and memory indicators obtained by the stress test includes: Compare the memory snapshot file obtained from the stress test with the preset memory usage sample; If the comparison result shows that the memory usage of the current component of the in-vehicle application to be tested is abnormal, the memory indicator obtained from the stress test is compared with the preset memory usage standard; When the memory indicator of the current component does not meet the preset memory usage standard, it is determined that the memory usage of the current component and the current in-vehicle application to be detected is abnormal.
6. The method according to claim 5, characterized in that The memory index obtained from the stress test is compared with the preset memory usage standard, including: Generate a memory change waveform chart during the stress test period based on the memory indicators obtained during the stress test, wherein the memory change waveform chart is a waveform chart showing changes in memory usage over time; The maximum memory usage value is read from the memory change waveform and compared with the maximum memory usage threshold in the preset memory usage standard. If the maximum memory usage value exceeds the maximum memory usage threshold, it is determined that the memory indicator of the current component does not meet the preset memory usage standard. The memory change state is read from the memory change waveform. If the memory keeps increasing, it is determined that the memory indicator of the current component does not meet the preset memory usage standard.
7. The method according to claim 1, characterized in that The preset memory analysis tool is developed in an application integrated development environment, and the memory indicator script is developed through a command line tool.
8. A device for detecting memory usage of vehicle-mounted applications, characterized in that: include: A splitting module is used to split the in-vehicle application to be tested into multiple components; The recording module is used to record the test script of the current component using a preset script recording tool for each component; The test module is used to perform stress testing on the current component based on the preset memory analysis tools and memory indicator scripts according to the current component's test script; The determination module is used to determine whether the memory usage of the vehicle application to be tested is abnormal based on the preset memory usage sample and memory usage standard and the memory snapshot file and memory indicators obtained by the stress test.
9. A computer device comprising: The method comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the method implements the steps of the method for detecting the memory occupancy of an in-vehicle application as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for detecting the memory usage of an in-vehicle application according to any one of claims 1 to 7 are implemented.