Memory leak processing method and device, vehicle, electronic equipment and storage medium
By obtaining vehicle status information to determine the restart conditions and controlling the restart of the vehicle system, the problem of uncertain restart caused by memory leakage in the vehicle system is solved, and vehicle driving safety and user experience are improved.
Patent Information
- Application Number
- CN202410465542.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2025-10-24
AI Technical Summary
Uncertain restarts or black screens caused by memory leaks in the vehicle computer system may cause vehicle driving safety issues or affect the user's human-computer interaction experience.
By obtaining vehicle status information, it is determined whether the interaction status of the vehicle system and the vehicle driving status meet the preset restart conditions, and the vehicle system is controlled to execute the restart command when the conditions are met, avoiding unnecessary restarts in driving or interaction scenarios.
It avoids vehicle driving safety issues and user experience impacts, and improves vehicle driving safety and user experience.
Smart Images

Figure CN120832283A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle technology, and in particular to a memory leak processing method and device, a vehicle, an electronic device, and a storage medium. Background Art
[0002] A memory leak occurs when unneeded memory in a system is not released, resulting in wasted memory resources and decreased system performance. A memory leak can cause the total amount of memory used by the system to continuously increase until the system crashes or is forced to shut down. For example, a memory leak occurs when a system continuously requests memory but fails to release it promptly.
[0003] If a memory leak exists in the vehicle system and the amount of memory occupied by the leak exceeds a preset memory threshold, the vehicle system may restart or display a black screen at any time to free up the memory space occupied by the leak. Due to the uncertainty of the vehicle system restart time or black screen duration, if a restart or black screen is triggered while the vehicle is in motion or when the user is interacting with the vehicle system, it may cause vehicle driving safety issues or affect the user's human-computer interaction experience. Summary of the Invention
[0004] The present disclosure provides a memory leak handling method, device, electronic device, and storage medium. Its primary purpose is to address the issue of vehicle driving safety or user experience impairment when a memory leak occurs in a vehicle-mounted system. Due to the uncertainty of the vehicle-mounted system's restart time or screen blackout duration, a restart or screen blackout may occur during vehicle driving or during user interaction with the vehicle-mounted system.
[0005] According to a first aspect of the present disclosure, a memory leak processing method is provided, which includes:
[0006] When it is determined that the memory usage of the vehicle-mounted system exceeds a preset warning threshold when a memory leak occurs in the vehicle-mounted system, obtaining vehicle status information; the vehicle status information includes the interaction status of the vehicle-mounted system and the vehicle driving status;
[0007] Determining whether the interaction state of the vehicle-machine system satisfies a first preset restart condition, and whether the driving state of the vehicle satisfies a second preset restart condition;
[0008] If it is determined that the interaction state of the vehicle-mounted system does not satisfy the first preset restart condition, and / or the driving state of the vehicle does not satisfy the second preset restart condition, controlling the vehicle-mounted system not to execute the restart instruction;
[0009] If it is determined that the interaction state of the vehicle machine system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition, a restart instruction is controlled to be executed on the vehicle machine system.
[0010] Optionally, the first preset restart condition is that the vehicle machine system is not in an interaction state, and the second preset restart condition is that the vehicle is in a stop state.
[0011] The judgment on whether the interaction state of the vehicle machine system meets the first preset restart condition comprises:
[0012] The running time and interaction frequency of the vehicle machine system are acquired.
[0013] It is judged whether the running time and interaction frequency of the vehicle machine system meet a first preset threshold.
[0014] If it is determined that the running time and interaction frequency of the vehicle machine system do not meet the first preset threshold, it is determined that the vehicle machine system is not in an interaction state.
[0015] Optionally, after the vehicle machine system is controlled not to execute the restart instruction, the method further comprises:
[0016] The interaction state of the vehicle machine system and the vehicle driving state are monitored.
[0017] It is re-determined whether the memory occupation amount of the memory leakage exceeds the preset warning threshold.
[0018] The control of the vehicle machine system to execute the restart instruction further comprises:
[0019] If it is determined that the memory occupation amount of the current vehicle machine system memory leakage exceeds the preset memory threshold, the interaction state of the vehicle machine system meets the first preset restart condition, and the vehicle driving state meets the second preset restart condition, the vehicle machine system is controlled to execute the restart instruction.
[0020] Optionally, before the vehicle state information is acquired, the method comprises:
[0021] It is determined whether the available memory of the vehicle machine system has been recycled.
[0022] After it is determined that the available memory has been recycled, it is judged whether the remaining memory amount of the vehicle machine system is lower than a preset upper limit of the remaining memory.
[0023] If it is determined that the remaining memory amount is lower than the preset upper limit of the remaining memory, it is determined whether the vehicle machine system has memory leakage.
[0024] If it is determined that the vehicle machine system has memory leakage, the memory occupation amount of the memory leakage is determined.
[0025] Optionally, the determining whether the car machine system has a memory leak comprises:
[0026] obtaining a memory usage index, the memory usage index comprising a memory amount used by a kernel allocator, a kernel stack size, a virtual memory amount, a memory amount used by a page table manager, and a memory size used by the kernel;
[0027] respectively determining whether the memory amount used by the kernel allocator, the kernel stack size, the virtual memory amount, the memory amount used by the page table manager, and the memory size used by the kernel all satisfy corresponding second preset thresholds;
[0028] if any one of the memory amount used by the kernel allocator, the kernel stack size, the virtual memory amount, the memory amount used by the page table manager, and the memory size used by the kernel does not satisfy the second preset threshold, determining that the car machine system has a memory leak.
[0029] According to a second aspect of the present disclosure, a memory leak processing apparatus is provided, comprising:
[0030] an obtaining unit configured to, in a case where a memory occupation amount of a car machine system when it is determined that the car machine system has a memory leak exceeds a preset warning threshold, obtain vehicle state information; the vehicle state information comprising an interaction state of the car machine system and a vehicle driving state;
[0031] a determining unit configured to determine whether the interaction state of the car machine system satisfies a first preset restart condition and whether the vehicle driving state satisfies a second preset restart condition;
[0032] a first control unit configured to, if it is determined that the interaction state of the car machine system does not satisfy the first preset restart condition and / or the vehicle driving state does not satisfy the second preset restart condition, control the car machine system not to execute a restart instruction;
[0033] a second control unit configured to, if it is determined that the interaction state of the car machine system satisfies the first preset restart condition and the vehicle driving state satisfies the second preset restart condition, control the car machine system to execute the restart instruction.
[0034] Optionally, the first preset restart condition is that the car machine system is not in an interaction state, and the second preset restart condition is that the vehicle is in a stop state.
[0035] The determining unit comprises:
[0036] an obtaining module configured to obtain a running time and an interaction frequency of the car machine system;
[0037] The first determining module is configured to determine whether the running time and the interaction frequency of the car machine system satisfy a first preset threshold value.
[0038] The determining module is configured to determine that the car machine system is not in the interaction state if it is determined that the running time and the interaction frequency of the car machine system do not satisfy the first preset threshold value.
[0039] Optionally, the device further comprises a monitoring unit, and the monitoring unit comprises:
[0040] The monitoring module is configured to monitor the interaction state of the car machine system and the driving state of the vehicle after the car machine system is controlled not to execute the restart instruction.
[0041] The first determining module is configured to re-determine that the memory usage of the memory leakage exceeds the preset warning threshold value.
[0042] The second control unit is further configured to:
[0043] If it is determined that the memory usage of the memory leakage of the car machine system exceeds the preset memory threshold value, the interaction state of the car machine system satisfies the first preset restart condition, and the driving state of the vehicle satisfies the second preset restart condition, the car machine system is controlled to execute the restart instruction.
[0044] Optionally, the device further comprises a determining unit, and the determining unit comprises:
[0045] The second determining module is configured to determine whether the available memory of the car machine system has been recycled before the vehicle state information is acquired.
[0046] The second determining module is configured to determine whether the available memory of the car machine system has been recycled before the vehicle state information is acquired.
[0047] The third determining module is configured to determine whether the car machine system has memory leakage if it is determined that the remaining memory amount is lower than the preset remaining memory upper limit.
[0048] The fourth determining module is configured to determine the memory usage of the memory leakage if it is determined that the car machine system has memory leakage.
[0049] Optionally, the third determining module is further configured to:
[0050] The memory usage index comprises the amount of memory used by the allocator in the kernel, the size of the kernel stack, the amount of virtual memory, the amount of memory used by the management page table, and the size of the memory used by the kernel.
[0051] determine whether the memory amount used by the allocator, the kernel stack size, the virtual memory amount, the memory amount used by the management page table, and the memory size used by the kernel all satisfy corresponding second preset thresholds;
[0052] If it is determined that any one of the memory amount used by the allocator, the kernel stack size, the virtual memory amount, the memory amount used by the management page table, and the memory size used by the kernel does not satisfy the second preset threshold, it is determined that the car machine system has a memory leak.
[0053] According to a third aspect of the present disclosure, a vehicle is provided, and the vehicle comprises the memory leak processing apparatus according to the second aspect.
[0054] According to a fourth aspect of the present disclosure, an electronic device is provided, and the electronic device comprises:
[0055] at least one processor; and
[0056] a memory connected to the at least one processor in communication; wherein
[0057] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0058] According to a fifth aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method according to the first aspect.
[0059] According to a sixth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to the first aspect.
[0060] The memory leakage processing method and device, the electronic device and the storage medium provided by the present disclosure can determine that the memory usage of the memory leakage of the vehicle machine system exceeds the preset warning threshold, acquire vehicle state information, the vehicle state information includes the interactive state of the vehicle machine system and the vehicle driving state, determine whether the interactive state of the vehicle machine system meets the first preset restart condition and whether the vehicle driving state meets the second preset restart condition, control the vehicle machine system not to execute the restart instruction if it is determined that the interactive state of the vehicle machine system does not meet the first preset restart condition and / or the vehicle driving state does not meet the second preset restart condition, and control the vehicle machine system to execute the restart instruction if it is determined that the interactive state of the vehicle machine system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition. Compared with the related art, the memory leakage processing method provided by the present disclosure can determine whether to control the vehicle machine system to execute the restart instruction through the vehicle state information when the memory usage of the memory leakage exceeds the preset warning threshold, avoid triggering the restart or black screen in the vehicle driving scene or in the human-computer interaction scene of the user and the vehicle machine system, avoid causing the safety problem of the vehicle driving, improve the safety of the vehicle driving, and improve the vehicle driving experience of the user.
[0061] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0062] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:
[0063] Figure 1 A flowchart of a memory leakage processing method provided by an embodiment of the present disclosure;
[0064] Figure 2 A flowchart of another memory leakage processing method provided by an embodiment of the present disclosure;
[0065] Figure 3 A flowchart of another memory leakage processing method provided by an embodiment of the present disclosure;
[0066] Figure 4 A structural diagram of a memory leakage processing device provided by an embodiment of the present disclosure;
[0067] Figure 5 A structural diagram of another memory leakage processing device provided by an embodiment of the present disclosure;
[0068] Figure 6 A schematic block diagram of an example electronic device 500 provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0069] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are presented for the purpose of illustration and description. It is to be understood that the embodiments described herein are merely exemplary and that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, for the purpose of clarity and the brevity of description, the description below omits the description of well-known functions and structures.
[0070] The embodiments of the present disclosure are not exhaustive, but are only illustrative of some embodiments, and are not specific limitations on the scope of protection of the present disclosure. In the case of no contradiction, each step in an embodiment can be implemented as an independent embodiment, and the steps can be combined arbitrarily, for example, the scheme after removing some steps in an embodiment can be implemented as an independent embodiment, and the order of the steps in an embodiment can be exchanged arbitrarily, in addition, the optional implementation in an embodiment can be combined arbitrarily; in addition, the embodiments can be combined arbitrarily, for example, the steps of different embodiments can be combined arbitrarily, an embodiment can be combined with the optional implementation of other embodiments.
[0071] In various embodiments of the present disclosure, the terms and / or descriptions of the embodiments are consistent and can be referred to each other if there is no special description and logical conflict, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship.
[0072] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments, and are not intended to be limiting on the present disclosure.
[0073] In the embodiments of the present disclosure, unless otherwise specified, the elements expressed in singular form, such as "one", "a", "the", "above", "said", "preceding", "this" and the like, can represent "one and only one", or "one or more", "at least one" and the like. For example, in the case of using articles such as "a", "an", "the" and the like in English, the noun after the article can be understood as singular expression, or as plural expression.
[0074] In some embodiments, the terms "greater than", "greater than or equal to", "not less than", "more than", "more than or equal to", "not less than", "higher than", "higher than or equal to", "not lower than", "above" and the like can be replaced with each other, and the terms "less than", "less than or equal to", "not greater than", "less than", "less than or equal to", "not more than", "lower than", "lower than or equal to", "not higher than", "below" and the like can be replaced with each other.
[0075] The prefix words of "first", "second" and the like in the embodiments of the present disclosure are only used to distinguish different description objects, and do not constitute limitation on the position, order, priority, quantity or content of the description objects. The description of the description objects should refer to the description in the context of the claims or embodiments, and should not constitute redundant limitation because of the use of the prefix words. In the embodiments of the present disclosure, "a plurality of" means two or more than two.
[0076] The memory leakage processing method, device, electronic equipment and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0077] Figure 1 A flowchart of a memory leakage processing method provided by the embodiments of the present disclosure is shown. The method is applied to a vehicle, and the control method can be executed by an information prompting control device or equipment. The device or equipment can be configured in a server, a processor or a master control chip. For example, it can be arranged on the vehicle machine side, the domain controller side, etc., as shown in the figure. The method comprises the following steps: Figure 1
[0078] Step 101, when it is determined that the memory occupation of the vehicle machine system in the case of memory leakage exceeds the preset warning threshold, obtaining vehicle state information; the vehicle state information includes the interactive state of the vehicle machine system and the vehicle driving state.
[0079] In actual application, memory leakage refers to that the memory which is no longer needed in the vehicle machine system is not released, thereby causing waste of memory resources and performance degradation of the vehicle machine system. Its characteristic is that the total amount of memory used by the vehicle machine system continues to increase until the vehicle machine system crashes or is forced to close. For example, when a process in the vehicle machine system continuously applies for memory but does not release it in time, memory leakage will occur. The memory occupation of a memory leakage is small, and it may have little effect on the vehicle machine system, so it does not need to be processed; but when multiple memory leakages accumulate, the memory occupation exceeds the preset warning threshold, and the memory cannot be released through the recycling process, which will greatly affect the operation of the vehicle machine system, and may cause the vehicle machine system to run out of memory and even crash. Therefore, the vehicle machine system will randomly restart the vehicle machine system in order to release the memory occupation of the memory leakage and recover the memory space. However, since the restart of the existing vehicle machine system is random, the restart time is uncontrollable, if the vehicle machine system restarts in the vehicle driving scene, it may cause panic of the driver and passengers, affect the driver's driving, and thus cause driving safety problems; if the vehicle machine system restarts in the scene of human-computer interaction between the user and the vehicle machine system, it will seriously affect the user's experience of human-computer interaction.
[0080] Therefore, in order to solve the uncertainty of the restart time or black screen time of the vehicle system, if the restart or black screen is triggered in the vehicle driving scenario, or in the human-computer interaction scenario between the user and the vehicle system, vehicle driving safety problems may occur, or problems may affect the user's human-computer interaction experience. When it is determined that there is a memory leak in the vehicle system and the memory usage exceeds the preset warning threshold, the vehicle status information is first obtained. The vehicle status information includes the interaction status of the vehicle system and the vehicle driving status. By judging the interaction status of the vehicle system and the vehicle driving status, it is determined whether to restart, or to select a certain time to restart.
[0081] Step 102 : determining whether the interaction state of the vehicle-machine system satisfies a first preset restart condition, and whether the vehicle driving state satisfies a second preset restart condition.
[0082] In one embodiment provided in the present disclosure, in order to avoid restarting the vehicle system when the vehicle is in a driving state or the vehicle system is in an interactive state, the first preset restart condition can be set to that the vehicle system is not in an interactive state, and the second preset restart condition can be set to that the vehicle system is in a stopped state.
[0083] Step 103 : If it is determined that the interaction state of the vehicle-mounted system does not satisfy the first preset restart condition, and / or the vehicle driving state does not satisfy the second preset restart condition, the vehicle-mounted system is controlled not to execute the restart instruction.
[0084] In order not to affect the user's driving experience, when the vehicle system is in an interactive state, and / or the vehicle is in a driving state, that is, the interactive state of the vehicle system does not meet the first preset restart condition, and / or the vehicle driving state does not meet the second preset restart condition, the vehicle system is controlled not to execute the restart instruction.
[0085] Step 104 : If it is determined that the interaction state of the vehicle-mounted system satisfies the first preset restart condition, and the vehicle driving state satisfies the second preset restart condition, the vehicle-mounted system is controlled to execute a restart instruction.
[0086] In the embodiment provided by the present disclosure, when it is determined that the vehicle system is not in an interactive state and the vehicle is in a stopped state, controlling the vehicle system to execute a restart instruction will not cause driving safety problems and will have little impact on the user's car experience.
[0087] The memory leakage processing method provided in the disclosure can determine whether to control the vehicle machine system to execute a restart instruction according to vehicle state information when the memory occupancy of the memory leakage exceeds the preset warning threshold, avoid triggering a restart or a black screen in a vehicle driving scenario or in a user-vehicle machine system human-computer interaction scenario, avoid causing a safety problem of vehicle driving, improve the safety of vehicle driving, and improve the user experience of vehicle driving.
[0088] The specific determination method of the determination of whether the interactive state of the vehicle machine system meets the first preset restart condition is as follows.
[0089] (1) Obtain the running time and the interactive frequency of the vehicle machine system.
[0090] The running time and the interactive frequency of the vehicle machine system are interactive state information of the vehicle machine system, and are used to determine the current interactive state of the vehicle machine system.
[0091] (2) Determine whether the running time and the interactive frequency of the vehicle machine system meet the first preset threshold.
[0092] In the embodiments provided in the disclosure, the first preset threshold includes a running time threshold and an interactive frequency threshold corresponding to the running time and the interactive frequency, respectively. If the running time meets the running time threshold and the interactive frequency also meets the interactive frequency threshold, that is, if the running time and the interactive frequency of the vehicle machine system both meet the first preset threshold, it indicates that the vehicle machine system is in an interactive state at this time, or the possibility that the vehicle machine system is in an interactive state is extremely high, and the user may need to use the vehicle machine system at any time. At this time, controlling the vehicle machine system to restart may seriously affect the interactive experience of the user.
[0093] (3) If it is determined that the running time and the interactive frequency of the vehicle machine system both do not meet the first preset threshold, it is determined that the vehicle machine system is not in an interactive state.
[0094] When it is determined that the running time does not meet the running time threshold and the interaction frequency also does not meet the interaction frequency threshold, it can be determined that the car machine system is not in an interaction state or the possibility of the car machine system being in an interaction state is extremely small, and the user does not need to use the car machine system at this time.
[0095] By the method provided in the above embodiment, it can be determined whether the current car machine system is in an interaction state, and then it can be determined whether to control the car machine system to execute a restart instruction.
[0096] As a further explanation of the above step 103, after controlling the car machine system not to execute the restart instruction, since the memory leakage still exists, in order to solve the problem of memory leakage, the following methods can be used but are not limited to:
[0097] As shown in FIG. 8, the method includes the following steps: Figure 2
[0098] Step 201, monitoring the interaction state of the car machine system and the vehicle driving state.
[0099] After controlling the car machine system not to execute the restart instruction, the vehicle will continue to monitor the interaction state of the car machine system and the vehicle driving state through a camera or a sensor and the like until it is monitored that the interaction state of the car machine system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition.
[0100] Step 202, re-determining whether the memory occupation amount of the memory leakage exceeds the preset warning threshold.
[0101] Since the occupation amount of the memory leakage can change in the monitoring time period, it is necessary to re-determine whether the memory occupation amount of the memory leakage exceeds the preset warning threshold.
[0102] Step 203, controlling the car machine system to execute the restart instruction.
[0103] If it is determined that the memory occupation amount of the memory leakage of the current car machine system exceeds the preset memory threshold, the interaction state of the car machine system meets the first preset restart condition, and the vehicle driving state meets the second preset restart condition, the car machine system is controlled to execute the restart instruction.
[0104] By the method provided in the above embodiments, the vehicle machine system is controlled not to execute the restart instruction in the case that the interactive state of the vehicle machine system does not satisfy the first preset restart condition and / or the vehicle driving state does not satisfy the second preset restart condition; then the vehicle driving state and the interactive state of the vehicle machine system are monitored until it is monitored that the memory space occupied by the current memory leakage exceeds the preset memory threshold, the interactive state of the vehicle machine system satisfies the first preset restart condition, and the vehicle driving state satisfies the second preset restart condition, and then the vehicle machine system is restarted, so that the processing of the memory leakage of the vehicle machine system is completed without affecting the user driving and the user interactive experience.
[0105] In order to determine whether the memory occupation of the memory leakage exceeds the preset warning threshold, the following methods can be used, but are not limited to:
[0106] As shown in the method shown in Figure 3 The method comprises the following steps:
[0107] Step 301, determining whether the available memory of the vehicle machine system has been recycled.
[0108] Step 302, after determining that the available memory has been recycled, judging whether the remaining memory amount of the vehicle machine system is lower than the preset upper limit of the remaining memory.
[0109] In the embodiments provided in the present disclosure, the memory space of the vehicle machine system is divided into two blocks of user space (Userspace) and core space (Kernel space). In general, a process usually only occupies the memory of the user space, but when the memory amount of the user space is exhausted, the memory of the process may occupy the memory of the core space, that is, the vehicle machine system has memory leakage. Before obtaining the vehicle state information, it is determined whether the available memory of the vehicle machine system has been recycled, and the available memory is the memory occupied by the process in the user space. If it is determined that the available memory has been recycled, but the remaining memory amount of the vehicle machine system is still lower than the preset upper limit of the remaining memory, it is considered that there may be memory leakage, and the memory leakage may not be in the user space, that is, the memory occupation amount of the memory leakage may occupy the memory of the core space. Since the process recycling mechanism can only recycle the memory amount occupied by the process in the user space, it cannot recycle the memory of the core space, so the process recycling mechanism cannot further release the memory, and therefore it is necessary to further check and confirm whether the vehicle machine system has memory leakage, so as to process the memory leakage to the core space.
[0110] Step 303, if it is determined that the remaining memory amount is lower than the preset upper limit of the remaining memory, it is determined whether the vehicle machine system has memory leakage.
[0111] Memory leaks can be detected using memory monitoring tools such as Windows Task Manager, or specialized memory leak detection tools such as Valgrind. These tools can help developers detect and resolve memory leaks in a timely manner.
[0112] Step 304: If it is determined that there is a memory leak in the vehicle computer system, the memory usage of the memory leak is determined.
[0113] As a refinement of the above step 303, in order to further determine whether there is a memory leak in the vehicle-mounted system, the following method can be used but is not limited to: obtaining a memory usage indicator, the memory usage indicator includes the amount of memory used by the allocator in the kernel, the kernel stack size, the amount of virtual memory, the amount of memory used by the management page table, and the memory size used by the kernel; judging whether the amount of memory used by the allocator in the kernel, the kernel stack size, the amount of virtual memory, the amount of memory used by the management page table, and the memory size used by the kernel all meet the corresponding second preset threshold; if it is determined that any one of the amount of memory used by the allocator in the kernel, the kernel stack size, the amount of virtual memory, the amount of memory used by the management page table, and the memory size used by the kernel does not meet the second preset threshold, it is determined that a memory leak occurs in the vehicle-mounted system.
[0114] In summary, the embodiments of the present disclosure can achieve the following effects:
[0115] The memory leak processing method provided by the present invention can determine whether to control the vehicle system to execute a restart instruction through vehicle status information when the memory usage of the memory leak exceeds a preset warning threshold, thereby avoiding triggering a restart or a black screen in the vehicle driving scenario or in the human-computer interaction scenario between the user and the vehicle system, avoiding causing safety problems in vehicle driving, improving vehicle driving safety, and improving the user's car experience.
[0116] Corresponding to the above-mentioned memory leak processing method, the present invention also provides a memory leak processing device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment and will not be repeated in this invention.
[0117] Figure 4 A schematic diagram of the structure of a memory leak processing device provided by an embodiment of the present disclosure is shown as follows: Figure 4 As shown, it includes: an acquisition unit 41, a judgment unit 42, a first control unit 43 and a second control unit 44.
[0118] The acquisition unit 41 is configured to acquire vehicle state information when it is determined that the memory usage of the memory leakage of the car machine system exceeds the preset warning threshold.
[0119] The determination unit 42 is configured to determine whether the interactive state of the car machine system meets a first preset restart condition and whether the vehicle driving state meets a second preset restart condition.
[0120] The first control unit 43 is configured to control the car machine system not to execute a restart instruction if it is determined that the interactive state of the car machine system does not meet the first preset restart condition and / or the vehicle driving state does not meet the second preset restart condition.
[0121] The second control unit 44 is configured to control the car machine system to execute a restart instruction if it is determined that the interactive state of the car machine system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition.
[0122] The memory leakage processing device provided by the present disclosure acquires vehicle state information when it is determined that the memory usage of the memory leakage of the car machine system exceeds the preset warning threshold. The vehicle state information includes the interactive state of the car machine system and the vehicle driving state. The determination unit 42 is configured to determine whether the interactive state of the car machine system meets a first preset restart condition and whether the vehicle driving state meets a second preset restart condition. The first control unit 43 is configured to control the car machine system not to execute a restart instruction if it is determined that the interactive state of the car machine system does not meet the first preset restart condition and / or the vehicle driving state does not meet the second preset restart condition. The second control unit 44 is configured to control the car machine system to execute a restart instruction if it is determined that the interactive state of the car machine system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition. Compared with the related art, the memory leakage processing method provided by the present disclosure can determine whether to control the car machine system to execute a restart instruction through vehicle state information when the memory usage of the memory leakage exceeds the preset warning threshold, avoid triggering a restart or a black screen in a vehicle driving scenario or in a user-car machine system human-computer interaction scenario, avoid causing a safety problem of vehicle driving, improve the safety of vehicle driving, and improve the user's driving experience.
[0123] Further, in one possible implementation manner of the present embodiment, the first preset restart condition is that the car machine system is not in an interactive state, and the second preset restart condition is that the vehicle is in a stopped state.
[0124] Further, in one possible implementation manner of the present embodiment, as shown in Figure 5 The determination unit 42 includes:
[0125] The acquisition module 421 is configured to acquire the running time and the interaction frequency of the car machine system.
[0126] The first determination module 422 is configured to determine whether the running time and the interaction frequency of the car machine system satisfy the first preset threshold.
[0127] The determination module 423 is configured to determine that the car machine system is not in the interaction state if it is determined that the running time and the interaction frequency of the car machine system do not satisfy the first preset threshold.
[0128] Further, in a possible implementation manner of the embodiment, as shown in Figure 6 the device further includes a monitoring unit 45, and the monitoring unit 45 includes:
[0129] The monitoring module 451 is configured to monitor the interaction state of the car machine system and the driving state of the vehicle after the car machine system is controlled not to execute the restart instruction.
[0130] The first determination module 452 is configured to re-determine whether the memory occupation of the memory leakage exceeds the preset warning threshold.
[0131] Further, in a possible implementation manner of the embodiment, the second control unit 44 is further configured to:
[0132] If it is determined that the memory occupation of the current memory leakage of the car machine system exceeds the preset memory threshold, the interaction state of the car machine system satisfies the first preset restart condition, and the driving state of the vehicle satisfies the second preset restart condition, the car machine system is controlled to execute the restart instruction.
[0133] Further, in a possible implementation manner of the embodiment, as shown in Figure 5 the device further includes a determination unit 46, and the determination unit 46 includes:
[0134] The second determination module 461 is configured to determine whether the available memory of the car machine system has been recycled before acquiring the vehicle state information.
[0135] The second determination module 461 is configured to determine whether the available memory of the car machine system has been recycled before acquiring the vehicle state information.
[0136] The third determination module 463 is configured to determine whether the car machine system has memory leakage if it is determined that the remaining memory amount is lower than the preset upper limit of the remaining memory.
[0137] The fourth determination module 464 is configured to determine the memory occupation of the memory leakage if it is determined that the car machine system has memory leakage.
[0138] Further, in a possible implementation of the embodiment, the third determining module 463 is further configured to:
[0139] obtain a memory usage index, the memory usage index comprising a memory amount used by an allocator in the kernel, a kernel stack size, a virtual memory amount, a memory amount used by a page table manager, and a memory size used by the kernel;
[0140] respectively determine whether the memory amount used by the allocator in the kernel, the kernel stack size, the virtual memory amount, the memory amount used by the page table manager, and the memory size used by the kernel all satisfy corresponding second preset thresholds;
[0141] if it is determined that any one of the memory amount used by the allocator in the kernel, the kernel stack size, the virtual memory amount, the memory amount used by the page table manager, and the memory size used by the kernel does not satisfy the second preset threshold, it is determined that the car machine system has a memory leak.
[0142] It should be noted that the foregoing explanation and description of the method embodiments are also applicable to the device of the present embodiment, and the principle is the same, which is not limited in the present embodiment.
[0143] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0144] Figure 6 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.
[0145] As Figure 6As shown, the device 500 includes a computing unit 501 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 502 or a computer program loaded into a RAM (Random Access Memory) 503 from the storage unit 508. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An I / O (Input / Output) interface 505 is also connected to the bus 504.
[0146] A plurality of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, and the like; an output unit 507, such as various types of displays, speakers, and the like; a storage unit 508, such as a magnetic disk, an optical disk, and the like; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0147] The computing unit 501 can be various general and / or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, and the like. The computing unit 501 performs various methods and processes described above, such as the memory leak handling method. For example, in some embodiments, the memory leak handling method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the aforementioned memory leak handling method by any other appropriate means, such as by means of firmware.
[0148] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0149] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0150] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a linearly-programmed electrical connection, a portable computer diskette, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory), or flash memory, an optical fiber, a compact disc (CD) ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0151] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0152] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a LAN (local area network), a WAN (wide area network), the Internet, and a blockchain network.
[0153] The computer system can include clients and servers. This relationship can be between a client and a server that are typically remote from each other and typically interact through a communication network. The relationship between client and server exists by virtue of computer programs running on the respective computer systems and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS (Virtual Private Server, or VPS for short) services. The server can also be a server of a distributed system, or a server combined with a blockchain.
[0154] It should be noted that artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of humans (such as learning, reasoning, thinking, planning, etc.), both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc.; artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc. several major directions.
[0155] It should be understood that the various forms of the flow shown above can be used to reorder, add or delete steps. For example, each step described in the present disclosure can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.
[0156] The above detailed description does not constitute a limitation on the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included in the scope of protection of the present disclosure.
Claims
1. A memory leak handling method, characterized by, The method comprises: In a case where it is determined that the infotainment system has a memory leak and the memory occupancy exceeds a preset warning threshold, obtaining vehicle state information; The vehicle state information comprises an interaction state of the infotainment system and a vehicle driving state; Determining whether the interaction state of the infotainment system meets a first preset restart condition and whether the vehicle driving state meets a second preset restart condition; If it is determined that the interaction state of the infotainment system does not meet the first preset restart condition and / or the vehicle driving state does not meet the second preset restart condition, controlling the infotainment system not to execute a restart instruction; If it is determined that the interaction state of the infotainment system meets the first preset restart condition and the vehicle driving state meets the second preset restart condition, controlling the infotainment system to execute the restart instruction.
2. The method of claim 1, wherein, The first preset restart condition is that the infotainment system is not in an interaction state, and the second preset restart condition is that the vehicle is in a stop state; The determination of whether the interaction state of the infotainment system meets the first preset restart condition comprises: Obtaining a running time and an interaction frequency of the infotainment system; Determining whether the running time and the interaction frequency of the infotainment system both meet a first preset threshold; If it is determined that the running time and the interaction frequency of the infotainment system both do not meet the first preset threshold, determining that the infotainment system is not in an interaction state.
3. The method of claim 1, wherein, After controlling the infotainment system not to execute the restart instruction, the method further comprises: Monitoring the interaction state of the infotainment system and the vehicle driving state; Redetermining whether the memory occupancy of the memory leak exceeds the preset warning threshold; The control of the infotainment system to execute the restart instruction further comprises: If it is determined that the memory occupancy of the current memory leak of the infotainment system exceeds a preset memory threshold, the interaction state of the infotainment system meets the first preset restart condition, and the vehicle driving state meets the second preset restart condition, controlling the infotainment system to execute the restart instruction.
4. The method of claim 1, wherein, Before obtaining the vehicle state information, the method comprises: Determining whether the available memory of the infotainment system has been recycled; After determining that the available memory has been recycled, determining whether the remaining memory amount of the infotainment system is lower than a preset upper limit of remaining memory; If it is determined that the remaining memory amount is lower than the preset upper limit of remaining memory, determining whether the infotainment system has a memory leak; If it is determined that the infotainment system has a memory leak, determining the memory occupancy of the memory leak.
5. The method of claim 4, wherein, The determination of whether the infotainment system has a memory leak comprises: Obtaining a memory usage index, the memory usage index comprising a memory amount used by a kernel allocator, a kernel stack size, a virtual memory amount, a memory amount used by a management page table, and a memory size used by a kernel; Respectively determining whether the memory amount used by the kernel allocator, the kernel stack size, the virtual memory amount, the memory amount used by the management page table, and the memory size used by the kernel all meet corresponding second preset thresholds; If it is determined that any one of the amount of memory used by the allocator in the kernel, the size of the kernel stack, the amount of virtual memory, the amount of memory used by the management page table, and the size of the memory used by the kernel does not satisfy the second preset threshold, it is determined that the car machine system has a memory leak.
6. A memory leak handling apparatus, characterized by comprising: Comprising: an acquisition unit configured to acquire vehicle state information when it is determined that the memory usage of the car machine system exceeds a preset warning threshold in the case of a memory leak in the car machine system; the vehicle state information includes an interaction state of the car machine system and a vehicle driving state; a judgment unit configured to determine whether the interaction state of the car machine system satisfies a first preset restart condition and whether the vehicle driving state satisfies a second preset restart condition; a first control unit configured to control the car machine system not to execute a restart instruction if it is determined that the interaction state of the car machine system does not satisfy the first preset restart condition and / or the vehicle driving state does not satisfy the second preset restart condition; a second control unit configured to control the car machine system to execute a restart instruction if it is determined that the interaction state of the car machine system satisfies the first preset restart condition and the vehicle driving state satisfies the second preset restart condition.
7. A vehicle characterized by comprising: The vehicle comprises the memory leak processing device of claim 6.
8. An electronic device, comprising: Comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
9. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-5.
10. A computer program product, characterised in that, The computer program, when executed by a processor, implements the method of any one of claims 1-5. The computer program, when executed by a processor, implements the method of any one of claims 1-5.