Power Internet of Things system memory management method and electronic equipment

By compiling multiple commands into one executable file in the power IoT system and storing them in memory, the problem of poor memory management is solved, and more efficient memory management is achieved, preventing system performance degradation and crashes.

CN119415255APending Publication Date: 2025-02-11CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411503667.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

Memory management in power IoT systems is poor, resulting in performance degradation or system crash.

Method used

By obtaining multiple commands applied in the power IoT system, at least two integration commands that can be integrated in one executable file are determined, and the commands are compiled into one executable file and stored in system memory for memory management .

Benefits of technology

Reduces the number of executable files stored in memory, reduces the memory usage, improves memory management effect, and prevents system performance degradation and crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415255A_ABST
    Figure CN119415255A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a power Internet of Things system memory management method and electronic equipment. The method comprises the following steps: acquiring a plurality of commands applied in the power Internet of Things system; determining at least two integration commands which can be integrated in one executable file from the plurality of commands; and compiling all the determined integration commands into an executable file, and storing the executable file in a memory of the power Internet of Things system to realize memory management. According to the technical scheme, the memory management effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of electric power technology, and in particular to a memory management method and electronic device of an electric power Internet of Things system. Background Art

[0002] In the power Internet of Things (IoT) system, power IoT devices usually have limited hardware resources, especially memory resources. As an open source operating system, openEuler is widely used in various power IoT devices. However, due to the resource limitations of power IoT devices and the complex and diverse application requirements, memory management becomes a key challenge.

[0003] In the process of implementing the present invention, the inventors found that the following technical problems exist in the prior art: poor memory management effect, which will cause the performance of the power Internet of Things system to decline or even crash, which needs to be solved. Summary of the invention

[0004] The embodiments of the present invention provide a memory management method and electronic device for an electric power Internet of Things system, which solve the problem of poor memory management effect.

[0005] According to one aspect of the present invention, a method for memory management of a power Internet of Things system is provided, which may include:

[0006] Get multiple commands applied in the power Internet of Things system;

[0007] Determining at least two integrated commands from the plurality of commands that can be integrated into one executable file;

[0008] All the determined integrated commands are compiled into executable files, and the executable files are stored in the memory of the power Internet of Things system to achieve memory management.

[0009] According to another aspect of the present invention, there is provided an electronic device, which may include:

[0010] at least one processor; and

[0011] a memory communicatively connected to at least one processor; wherein,

[0012] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor implements the power Internet of Things system memory management method provided by any embodiment of the present invention when executing.

[0013] The technical solution of the embodiment of the present invention is to obtain multiple commands applied in the power Internet of Things system; determine at least two integrated commands that can be integrated into one executable file from the multiple commands; then, compile all the determined integrated commands into one executable file, and store the executable file in the memory of the power Internet of Things system to achieve memory management. Compared with compiling multiple commands into different executable files respectively, and then storing the obtained multiple executable files in the memory, the above technical solution compiles at least two integrated commands that can be integrated into one executable file from the multiple commands into one executable file, and then stores the one executable file in the memory, that is, by reducing the number of executable files stored in the memory, the memory usage of the executable file in the memory is reduced, thereby improving the memory management effect.

[0014] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0016] Figure 1 This is a flowchart of a memory management method for a power Internet of Things system provided according to an embodiment of the present invention;

[0017] Figure 2 This is a flowchart of an example of memory management of an electric power Internet of Things system based on openEuler in a memory management method of an electric power Internet of Things system provided by an embodiment of the present invention;

[0018] Figure 3 is a flowchart of another power Internet of Things system memory management method provided by an embodiment of the present invention;

[0019] Figure 4 This is a flowchart of another method for memory management of a power Internet of Things system provided according to an embodiment of the present invention;

[0020] Figure 5 It is a structural block diagram of a memory management device for a power Internet of Things system provided according to an embodiment of the present invention;

[0021] Figure 6 It is a structural schematic diagram of an electronic device that implements the memory management method of the power Internet of Things system in an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The situations of "target", "original", etc. are similar and will not be repeated here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.

[0025] Figure 1 It is a flowchart of a method for memory management of a power Internet of Things system provided by an embodiment of the present invention. This embodiment is applicable to the case of managing the memory of a power Internet of Things system, and in particular, to the case of managing the memory of a power Internet of Things system deployed under openEuler. The method can be executed by a memory management device for a power Internet of Things system provided by an embodiment of the present invention, which can be implemented by software and / or hardware, and which can be integrated in an electronic device, which can be various user terminals or servers.

[0026] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:

[0027] S110. Obtain multiple commands applied in the power Internet of Things system.

[0028] The power Internet of Things system can be understood as an Internet of Things system for power to be memory managed. The command can be understood as a command applied in the power Internet of Things system. In combination with the application scenarios that may be involved in the embodiments of the present invention, it can be, for example, a command related to an object, a device, a power demand record, or an order, which is related to the actual situation and is not specifically limited here. The number of the command is multiple.

[0029] Get multiple commands applied in the power Internet of Things system.

[0030] S120: Determine at least two integrated commands that can be integrated into one executable file from the multiple commands.

[0031] Among them, during the compilation stage, multiple commands are currently compiled into different executable files, and then these executable files are stored in the memory of the power Internet of Things system, which results in excessive memory usage.

[0032] In this regard, an embodiment of the present invention proposes a technical solution of determining at least two integrated commands that can be integrated into an executable file from multiple commands, and then compiling these integrated commands into an executable file. This can reduce the memory usage of the executable file in the memory and improve the memory management effect.

[0033] Specifically, at least two integrated commands can be understood as commands that can be integrated into one executable file from multiple commands. The at least two integrated commands are determined from multiple commands, combined with the application scenarios that may be involved in the embodiments of the present invention. Optionally, this determination process can be implemented based on at least one of the following factors: the function of each command, the dependency between each command, the memory usage of each command, and the usage frequency of each command. The specific selected factors can be determined according to the preset compilation options, which are not specifically limited here.

[0034] S130. Compile all determined integrated commands into executable files, and store the executable files in the memory of the power Internet of Things system to achieve memory management.

[0035] Among them, all the determined integrated commands are compiled into an executable file, for example, using tools such as Makefile or CMake to manage the compilation process, and all the integrated commands are compiled into a single executable file; then, the executable file is stored in the memory of the power Internet of Things system to realize memory management.

[0036] On this basis, combined with the application scenarios that may be involved in the embodiments of the present invention, optionally, the main program of the power Internet of Things system can be used as the entry of the executable file, and each integrated command in the executable file shares a common code library and data structure. Thus, the command parsing logic can be implemented in the main program, and the corresponding integrated command in the executable file can be selected for scheduling according to the input parameters, thereby completing the command scheduling.

[0037] The technical solution of the embodiment of the present invention is to obtain multiple commands applied in the power Internet of Things system; determine at least two integrated commands that can be integrated into one executable file from the multiple commands; then, compile all the determined integrated commands into one executable file, and store the executable file in the memory of the power Internet of Things system to achieve memory management. Compared with compiling multiple commands into different executable files respectively, and then storing the obtained multiple executable files in the memory, the above technical solution compiles at least two integrated commands that can be integrated into one executable file from the multiple commands into one executable file, and then stores the one executable file in the memory, that is, by reducing the number of executable files stored in the memory, the memory usage of the executable file in the memory is reduced, thereby improving the memory management effect.

[0038] An optional technical solution, the above-mentioned power Internet of Things system memory management method further includes:

[0039] When it is detected that a memory page in the memory is to be swapped to a disk of the electric power Internet of Things system, the memory page is intercepted, and the intercepted memory page is compressed to obtain a compressed page;

[0040] Storing the compressed page in a compressed exchange area of ​​the power Internet of Things system, wherein the compressed exchange area is located in the memory;

[0041] In response to an access instruction for a memory page, if a compressed page corresponding to the memory page is stored in the compressed swap area, the compressed page is read and decompressed to return the memory page.

[0042] The above technical solution compresses and stores the memory pages pre-swapped to the disk in a compressed swap area in the memory, so that when the memory page is accessed, the memory page can be directly read from the compressed swap area without reading the memory page from the disk, thereby reducing the actual swap operations and improving memory utilization.

[0043] Exemplarily, the above technical solution can be implemented using zswap, which is a compressed swap buffer in the kernel of openEuler, located between the memory and the disk. The specific workflow is as follows:

[0044] Intercept memory page: When the power IoT system tries to swap a memory page to disk, zswap intercepts the memory page. In this example, the memory page can also be called a swap page.

[0045] Compressed memory page: Use a certain compression algorithm to compress the intercepted memory page to obtain a compressed page.

[0046] Storing compressed pages: When the memory pool is not full, the compressed pages are stored in the memory pool, which is the compressed swap area described above.

[0047] Fallback mechanism: When the memory pool is full or the compression effect is not good, zswap can write the uncompressed or failed compression memory pages to disk.

[0048] Page decompression: When it is necessary to access the swapped out memory page, zswap first checks the memory pool. If it is stored in the memory pool, it directly decompresses the corresponding compressed page and returns it to the power Internet of Things system without accessing the disk; otherwise, it accesses the disk to read the memory page.

[0049] On this basis, optionally, zram can be used to implement the compression and decompression process in the above example. Among them, zram is a memory-based block device that provides compressed memory function. Its workflow is as follows:

[0050] Block device creation: zram creates a compressed block device in memory;

[0051] Page write: When a memory page is written to the zram device, the memory page is compressed and stored in memory;

[0052] Page decompression and reading: When reading a memory page, zram can read the compressed page from the memory and decompress it, and then return the decompressed memory page to the power IoT system.

[0053] Another optional technical solution, the above-mentioned power Internet of Things system memory management method, also includes:

[0054] Monitor the memory usage of a target object of the power Internet of Things system, wherein the target object includes a target process and / or a target service;

[0055] When the memory usage is greater than a preset usage threshold, the memory usage of the target object is adjusted so that the memory usage is less than or equal to the preset usage threshold.

[0056] The above technical solution reduces the memory usage of a target object with excessive memory usage by adjusting the memory usage of the target object, thereby preventing memory overrun.

[0057] For example, the memory usage of the target process can be limited by cgroups, and the workflow is as follows:

[0058] Create cgroup: Create a new cgroup, which can be managed through the file system interface and mounted in the / sys / fs / cgroup directory;

[0059] Configure memory limits: In the created cgroup directory, there are multiple files for configuring memory limits, such as memory.limit_in_bytes, which is used to set memory limits (i.e., the preset usage thresholds mentioned above);

[0060] Add a process to a cgroup: By writing the PID of the target process to the tasks file of the cgroup, the target process is added to the cgroup so that it is subject to the memory limit.

[0061] As another example, you can directly limit the memory usage of the target service through the Systemd configuration file. The specific steps are as follows:

[0062] Configuration file editing: Each target service has a corresponding systemd unit file (unit file), located in the / etc / systemd / system / or / lib / systemd / system / directory; edit these files to set the memory limit for each target service separately;

[0063] Set memory limit instructions: In the unit file, directly limit the memory usage of the target service by adding memory limit related instructions; for example:

[0064] MemoryLimit=: used to set the maximum memory usage of the target service. The maximum memory usage can be understood as the preset usage threshold mentioned above.

[0065] MemoryHigh=: used to set the high water mark of the target service. If the high water mark is exceeded, memory recycling is triggered.

[0066] Reload the configuration and restart the target service: After editing the unit file, reload the systemd configuration and restart the target service to make the configuration effective, and then use systemctl daemon-reload and systemctl restart <service>Command implementation.

[0067] Another optional technical solution, the above-mentioned power Internet of Things system memory management method further includes:

[0068] When the available amount of memory is less than a preset available amount threshold, scanning the memory usage of each process of the power Internet of Things system;

[0069] According to the scanned total memory usage and the process priority of each process, a termination process is determined from all processes, and the termination process is terminated.

[0070] The above technical solution ensures the stable operation of the power Internet of Things system by terminating the process with high memory consumption in advance (i.e. terminating the process) when the memory is insufficient.

[0071] For example, when the available memory capacity of the memory is less than the preset available capacity threshold, earlyoom can be used to scan all running processes, and then the most appropriate process is selected for termination according to the memory consumption (i.e., memory usage) and priority of each process. Here, by terminating the high memory consumption process in advance, earlyoom can effectively prevent the power Internet of Things system from entering the Out of Memory (OOM) state, thereby maintaining the overall stability of the power Internet of Things system.

[0072] As another example, when the compressed swap area in the memory is insufficient, a similar solution can be adopted. Specifically, the vm.swappiness parameter is used to adjust the swap behavior. This parameter controls the tendency of the kernel to swap, and the value range is 0 to 100. The larger the value, the more inclined to use the compressed swap area. You can control whether to swap by adjusting the value of this parameter, thereby avoiding the overflow of the compressed swap area.

[0073] Another optional technical solution, the above-mentioned power Internet of Things system memory management method also includes:

[0074] In the case of a memory leak being detected, the target code causing the memory leak in the entire code of the power Internet of Things system is determined;

[0075] Analyze the target code to determine why the allocated memory in the memory is not released;

[0076] Depending on the reason, add memory release code to the entire code to use the memory release code to release the allocated memory.

[0077] The above technical solution, when a memory leak is detected, adds a memory release code at the corresponding position by timely analyzing the cause, so as to use the memory release code to release the allocated memory and avoid memory leaks, thereby ensuring the long-term stable operation of the power Internet of Things system.

[0078] For example, the memory leak can be located and fixed according to the Valgrind report. The specific steps are as follows:

[0079] Identify the memory leak code location: Use the stack information provided in the Valgrind report to determine the code location of the corresponding code that causes the memory leak.

[0080] Analyze the cause of the memory leak: Check the corresponding code according to the code location, analyze the memory allocation and release logic, and find out why the allocated memory is not released.

[0081] Fix memory leaks: Add memory release code at the appropriate location according to the cause to ensure that all allocated memory can be released at the appropriate time.

[0082] After the fix, you can run the application again with Valgrind to verify that the memory leak problem has been solved. If not, repeat the above steps until there are no clear lost memory blocks in Valgrind's report.

[0083] On this basis, Valgrind reports can optionally include detailed information about each memory leak, as follows:

[0084] Definitely lost: Memory blocks that are clearly lost, which means that the application did not release the memory.

[0085] Indirectly lost: Memory blocks that are indirectly lost, which is usually caused by directly lost memory blocks.

[0086] Possibly lost: Memory blocks that may be lost. This is usually because the application retains pointers to these memory blocks, but these pointers are no longer in reachable range.

[0087] Still reachable: Memory blocks that are still reachable. The application still retains references to these memory blocks when it exits. This is not necessarily a memory leak, but it is necessary to check whether they should be released before the application exits.

[0088] On this basis, in addition to the several memory management solutions described above, combined with the application scenarios that may be involved in the embodiments of the present invention, memory management can also be achieved by optimizing memory allocation. The specific steps are as follows:

[0089] Install jemalloc: Use openEuler's package manager to install jemalloc;

[0090] Configure the system to use jemalloc: For applications that need to be compiled, you can link to the jemalloc library during compilation, so that the application can use jemalloc for memory allocation at runtime;

[0091] Optimization and tuning: jemalloc provides a variety of configuration options that can be adjusted through environment variables, for example, enabling background threads to optimize memory recycling, or adjusting the number of arenas to balance the performance and efficiency of memory allocation.

[0092] Install tcmalloc: Install tcmalloc through the openEuler package manager;

[0093] Configure the system to use tcmalloc: For applications that need to be compiled, you can link to the tcmalloc library during compilation so that it uses tcmalloc for memory allocation at runtime;

[0094] Optimization and tuning: cmalloc also provides a variety of configuration options that can be adjusted through environment variables. For example, the size of the thread cache can be adjusted to optimize memory allocation performance in a high-concurrency environment.

[0095] Reduce page overhead based on Transparent Huge Pages:

[0096] Check whether the system supports THP: On the openEuler system, you can check the current status of THP by viewing the system files. Usually, you can obtain the current THP configuration by viewing the target files in the virtual file system related to memory management.

[0097] Enable THP: If THP is not enabled, you need to enable it through the system configuration file or command. You can choose to set THP to always be enabled so that the system will automatically convert appropriate memory areas to large pages;

[0098] Adjust THP policy: You can choose to set THP to be enabled on demand (madvise mode), so that the system will only use huge pages when the application explicitly requests it;

[0099] Configure applications to use THP: For applications that need optimization, you can explicitly request the use of large pages when allocating memory. This can prompt the operating system to allocate large pages for specific memory areas through the memory management library or system calls.

[0100] On this basis, in order to better understand the above technical solutions as a whole, an example of memory management of the power Internet of Things system based on openEuler is given below. Figure 2 The specific implementation process of this example is as follows:

[0101] Optimize system basic components: Use BusyBox to integrate multiple commands into one executable file to reduce memory usage, and configure the MQTT protocol to achieve efficient communication;

[0102] Enable memory compression: Enable zswap to create a compressed swap area in memory, thereby reducing actual swap operations, improving memory utilization, and configuring zram to use compressed memory as swap space;

[0103] Limit memory usage: Use cgrousp to limit the memory usage of the target process, and directly limit the memory usage of the target service through the systemd configuration file to prevent memory overruns;

[0104] Real-time monitoring of memory usage: Provides comprehensive system performance monitoring based on sysstat and smem, and provides memory usage reports based on the monitoring results. Sysstat provides a system performance monitoring tool set, and smem is used for detailed memory usage analysis to comprehensively monitor the system's memory usage;

[0105] Optimize memory allocation: Use jemalloc or tcmalloc to allocate and release memory, and use Transparent Huge Pages to reduce page overhead and improve memory allocation efficiency.

[0106] Low memory warning and recycling: Based on earlyoom, processes that consume large amounts of memory are terminated in advance when memory is insufficient, and memory recycling and cache management are optimized based on memory recycling strategies to ensure stable system operation;

[0107] Memory leak detection: Memory leak detection is performed based on Valgrind to further ensure long-term stable operation of the system.

[0108] The above example, through multi-faceted optimization, solves a series of problems such as memory leakage and insufficient memory caused by poor memory management, and realizes effective management of the memory of the power Internet of Things system.

[0109] Figure 3 It is a flowchart of another method for memory management of a power Internet of Things system provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, determining at least two integrated commands that can be integrated into an executable file from multiple commands may include: determining at least two commands that are functionally related and / or have a dependency relationship from multiple commands, and using each determined command as an integrated command that can be integrated into an executable file. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.

[0110] See also Figure 3 Here, taking the case of "and" as an example, the method of this embodiment may specifically include the following steps:

[0111] S210. Obtain multiple commands applied in the power Internet of Things system.

[0112] S220: Determine at least two commands that are functionally related and / or have a dependency relationship from the multiple commands, and use each of the determined commands as an integrated command that can be integrated into an executable file.

[0113] Among them, for at least two commands that are functionally related and / or have a dependency relationship among multiple commands, there is an association relationship between them, and this association relationship may be reflected in the command scheduling. Therefore, these commands can be treated as integrated commands and integrated into an executable file, thereby improving the convenience of scheduling.

[0114] S230. Compile all determined integrated commands into executable files, and store the executable files in the memory of the power Internet of Things system to achieve memory management.

[0115] The technical solution of the embodiment of the present invention integrates at least two commands that are functionally related and / or have a dependency relationship among multiple commands as integrated commands into one executable file, so that there is an association relationship between the integrated commands in one executable file, which helps to improve the convenience of command scheduling.

[0116] An optional technical solution is that after each determined command is used as an integrated command that can be integrated into an executable file, the above-mentioned power Internet of Things system memory management method further includes:

[0117] For independent commands other than all integrated commands among the plurality of commands, determining at least one command score of the independent command, wherein the at least one command score comprises at least one of a dependency score between the independent command and each integrated command, a usage frequency score of the independent command, a complexity score after the independent command is integrated with all integrated commands, and a memory consumption score of the independent command;

[0118] An integration score of the independent command is determined according to at least one command score, and when the integration score is greater than a preset score threshold, the independent command is used as a new integrated command.

[0119] Among them, an independent command can be understood as a highly independent command among multiple commands that has no correlation with the integrated commands. Therefore, whether the independent command is also integrated into the executable file where the integrated commands are located can be obtained based on at least one command score of the independent command.

[0120] Specifically, the command score may be a dependency score between an independent command and each integrated command. The dependency score D may be determined based on the ratio of the number NC of dependencies between the independent command and each integrated command to the number TC of all commands, that is,

[0121] The command score may be a usage frequency score of an independent command, and the usage frequency score F may be determined based on the ratio between the number of times the independent command is used UC and the number of times all commands are used TUC, that is,

[0122] The command score can be a complexity score after the independent command is integrated with all integrated commands. The complexity score C can be determined according to the ratio between the number of code lines Li after the independent command is integrated and the number of code lines Ic before the independent command is integrated, that is,

[0123] The command score may be a memory consumption score of an independent command, and the memory consumption score R may be determined based on the ratio between the memory usage RC of the independent command and the total memory usage Tru of all commands, that is,

[0124] Further, according to at least one command score, an integrated score of the independent commands is determined, for example, the weighted sum of the scores of each command can be used as the integrated score. For example, here, taking at least one command score including a dependency score D, a usage frequency score F, a complexity score C, and a memory consumption score R as an example, the integrated score IS can be expressed by the following formula:

[0125] IS=α·D+β·F-γ·C-δ·R;

[0126] Among them, α, β, γ and δ represent the weight coefficients of the corresponding command scores respectively.

[0127] Furthermore, when the integration score is greater than a preset score threshold, the independent command may be integrated into the executable file as a new integrated command; otherwise, the independent command does not need to be integrated into the executable file.

[0128] The above technical solution determines at least one command score of an independent command, and then determines the integration score of the independent command based on each command score. The integration score can be used to determine whether to integrate the independent command into the executable file where each integrated command is located, thereby accurately determining whether the independent command is integrated.

[0129] Figure 4 It is a flowchart of another method for memory management of an electric power Internet of Things system provided in an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, at least two integrated commands that can be integrated into an executable file are determined from multiple commands, including: obtaining a preset first occupancy threshold, determining at least two commands whose memory occupancy is less than the first occupancy threshold from multiple commands; and using each determined command as an integrated command that can be integrated into an executable file. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.

[0130] See also Figure 4 The method of this embodiment may specifically include the following steps:

[0131] S310. Obtain multiple commands applied in the power Internet of Things system.

[0132] S320: Obtain a preset first occupancy rate threshold, and determine at least two commands from a plurality of commands whose memory occupancy rates are less than the first occupancy rate threshold.

[0133] S330: Utilize the determined commands as integrated commands that can be integrated into an executable file.

[0134] S340. Compile all determined integrated commands into executable files, and store the executable files in the memory of the power Internet of Things system to achieve memory management.

[0135] The technical solution of the embodiment of the present invention integrates at least two commands with smaller memory occupancy rates among multiple commands as integrated commands into one executable file, thereby reducing the memory occupancy rate of the executable file in the memory and further improving the memory management effect.

[0136] An optional technical solution, after the determined commands are respectively used as integrated commands that can be integrated into an executable file, the above-mentioned power Internet of Things system memory management method further includes:

[0137] Obtaining a preset second occupancy rate threshold that is greater than the first occupancy rate threshold;

[0138] Determine from the multiple commands an occupation command whose memory occupation rate is greater than a second occupation rate threshold, split the occupation command, and use the obtained split commands as new integrated commands.

[0139] Among them, the occupied command can be understood as a command with a larger memory usage rate among multiple commands. The command may occupy a large amount of memory due to the inclusion of multiple instructions, and the multiple instructions may not be completely required in a command scheduling. Therefore, the technical solution splits the occupied command to obtain at least two split commands, and integrates each split command as a new integrated command in the executable file, thereby improving the command integration.

[0140] Figure 5 This is a structural block diagram of the power Internet of Things system memory management device provided in an embodiment of the present invention. The device can be used to execute the power Internet of Things system memory management method provided in any of the above embodiments. The device and the power Internet of Things system memory management method in the above embodiments belong to the same inventive concept. For details not fully described in the embodiment of the power Internet of Things system memory management device, please refer to the embodiment of the power Internet of Things system memory management method. Figure 5 The device may specifically include: a command acquisition module 410, an integrated command determination module 420 and a memory management module 430.

[0141] The command acquisition module 410 is used to acquire multiple commands applied in the power Internet of Things system;

[0142] An integrated command determination module 420, configured to determine at least two integrated commands that can be integrated into one executable file from a plurality of commands;

[0143] The memory management module 430 is used to compile all the determined integrated commands into executable files and store the executable files in the memory of the power Internet of Things system to achieve memory management.

[0144] Optionally, the integrated command determination module 420 is specifically configured to:

[0145] At least two commands that are functionally related and / or have a dependency relationship are determined from the plurality of commands, and each of the determined commands is used as an integrated command that can be integrated into an executable file.

[0146] Optionally, based on the above device, the device may further include:

[0147] A command score determination module, for determining at least one command score of an independent command other than all the integrated commands in the plurality of commands, after each determined command is respectively used as an integrated command that can be integrated into an executable file;

[0148] An integrated command first obtaining module, used to determine the integrated score of the independent command according to at least one command score, and when the integrated score is greater than a preset score threshold, use the independent command as a new integrated command;

[0149] The at least one command score includes at least one of a dependency score between the independent command and each integrated command, a usage frequency score of the independent command, a complexity score after the independent command is integrated with all integrated commands, and a memory consumption score of the independent command.

[0150] Optionally, the integrated command determination module 420 is specifically configured to:

[0151] Obtaining a preset first occupancy rate threshold, and determining at least two commands whose memory occupancy rates are less than the first occupancy rate threshold from the multiple commands;

[0152] The determined commands are respectively used as integrated commands that can be integrated into an executable file.

[0153] Optionally, based on the above device, the device may further include:

[0154] A second occupancy rate threshold value acquisition module, used for acquiring a preset second occupancy rate threshold value greater than the first occupancy rate threshold value after being respectively used as integrated commands that can be integrated into one executable file;

[0155] The second integrated command obtaining module is used to determine the occupied commands whose memory occupancy rate is greater than the second occupancy rate threshold from multiple commands, split the occupied commands, and use the obtained split commands as new integrated commands.

[0156] Optionally, the above-mentioned power Internet of Things system memory management device further includes:

[0157] A compressed page obtaining module is used to intercept the memory page when it is detected that the memory page in the memory is to be exchanged to the disk of the power Internet of Things system, and compress the intercepted memory page to obtain a compressed page;

[0158] A compressed page storage module, used for storing the compressed page in a compressed exchange area of ​​the power Internet of Things system, wherein the compressed exchange area is located in the memory;

[0159] The memory page returning module is used to respond to the access instruction for the memory page, and when the compressed page corresponding to the memory page is stored in the compressed exchange area, read and decompress the compressed page to return the memory page.

[0160] Optionally, the above-mentioned power Internet of Things system memory management device further includes:

[0161] A memory usage monitoring module, used to monitor the memory usage of a target object of the power Internet of Things system, wherein the target object includes a target process and / or a target service;

[0162] The memory usage adjustment module is used to adjust the memory usage of the target object when the memory usage is greater than a preset usage threshold so that the memory usage is less than or equal to the preset usage threshold.

[0163] Optionally, the above-mentioned power Internet of Things system memory management device further includes:

[0164] A memory usage scanning module, used for scanning the memory usage of each process of the power Internet of Things system when the available memory of the memory is less than a preset available memory threshold;

[0165] The termination process termination module is used to determine the termination process from all processes according to the scanned total memory usage and the process priority of each process, and terminate the termination process.

[0166] Optionally, the above-mentioned power Internet of Things system memory management device further includes:

[0167] A target code determination module, used for determining the target code causing the memory leak in all codes of the power Internet of Things system when a memory leak is detected;

[0168] A cause determination module, used for analyzing the target code to determine the cause of the allocated memory in the memory not being released;

[0169] The allocated memory release module is used to add memory release code to the entire code according to the reason, so as to release the allocated memory by using the memory release code.

[0170] The memory management device of the power Internet of Things system provided by the embodiment of the present invention obtains multiple commands applied in the power Internet of Things system through a command acquisition module; determines at least two integrated commands that can be integrated into one executable file from multiple commands through an integrated command determination module; then, compiles all the determined integrated commands into one executable file through a memory management module, and stores the executable file in the memory of the power Internet of Things system to achieve memory management. Compared to compiling multiple commands into different executable files respectively, and then storing the obtained multiple executable files in the memory, the above-mentioned device compiles at least two integrated commands that can be integrated into one executable file from multiple commands into one executable file, and then stores the one executable file in the memory, that is, by reducing the number of executable files stored in the memory, the memory usage of the executable file in the memory is reduced, thereby improving the memory management effect.

[0171] The power Internet of Things system memory management device provided in the embodiment of the present invention can execute the power Internet of Things system memory management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0172] It is worth noting that in the above-mentioned embodiment of the memory management device of the electric power Internet of Things system, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0173] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0174] like Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0175] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0176] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the memory management method of the power Internet of Things system.

[0177] In some embodiments, the power Internet of Things system memory management method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the power Internet of Things system memory management method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the power Internet of Things system memory management method in any other appropriate manner (e.g., by means of firmware).

[0178] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0179] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0180] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0181] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device 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 trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0182] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0183] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may 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 difficult management and weak business scalability in traditional physical hosts and VPS services.

[0184] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0185] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.< / service>

Claims

1. A memory management method for a power Internet of Things system, characterized in that: include: Get multiple commands applied in the power Internet of Things system; Determining at least two integrated commands from the plurality of commands that can be integrated into one executable file; All the determined integrated commands are compiled into the executable file, and the executable file is stored in the memory of the power Internet of Things system to achieve memory management.

2. The method according to claim 1, characterized in that The step of determining at least two integrated commands that can be integrated into one executable file from the plurality of commands comprises: At least two commands that are functionally related and / or have a dependency relationship are determined from the plurality of commands, and each of the determined commands is used as an integrated command that can be integrated into an executable file.

3. The method according to claim 2, characterized in that After each of the determined commands is used as an integrated command that can be integrated into an executable file, the method further includes: For independent commands other than all the integrated commands among the plurality of commands, determining at least one command score of the independent command; Determine an integration score of the independent command according to at least one of the command scores, and use the independent command as a new integrated command if the integration score is greater than a preset score threshold; Among them, at least one of the command scores includes at least one of a dependency score between the independent command and each of the integrated commands, a usage frequency score of the independent command, a complexity score after integration of the independent command with all of the integrated commands, and a memory consumption score of the independent command.

4. The method according to claim 1, characterized in that The step of determining at least two integrated commands that can be integrated into one executable file from the plurality of commands comprises: Obtaining a preset first occupancy rate threshold, and determining at least two of the commands whose memory occupancy rates are less than the first occupancy rate threshold from the plurality of commands; The determined commands are respectively used as integrated commands that can be integrated into an executable file.

5. The method according to claim 4, characterized in that After the determined commands are respectively used as integrated commands that can be integrated into an executable file, the method further includes: Obtaining a preset second occupancy rate threshold that is greater than the first occupancy rate threshold; Determine from the multiple commands an occupation command whose memory occupation rate is greater than the second occupation rate threshold, split the occupation command, and use the obtained split commands as new integrated commands.

6. The method according to claim 1, characterized in that Also includes: When it is detected that a memory page in the memory is to be exchanged to a disk of the electric power Internet of Things system, the memory page is intercepted, and the intercepted memory page is compressed to obtain a compressed page; Storing the compressed page in a compression exchange area of ​​the electric power Internet of Things system, wherein the compression exchange area is located in the memory; In response to an access instruction for the memory page, when the compressed page corresponding to the memory page is stored in the compressed exchange area, the compressed page is read and decompressed to return the memory page.

7. The method according to claim 1, characterized in that Also includes: Monitoring the memory usage of a target object of the electric power Internet of Things system, wherein the target object includes a target process and / or a target service; When the memory usage is greater than a preset usage threshold, the memory usage of the target object is adjusted so that the memory usage is less than or equal to the preset usage threshold.

8. The method according to claim 1, characterized in that Also includes: When the available memory amount of the memory is less than a preset available memory amount threshold, scanning the memory usage of each process of the power Internet of Things system; According to all the scanned memory usages and the process priority of each of the processes, a termination process is determined from all the processes, and the termination process is terminated.

9. The method according to claim 1, characterized in that: Also includes: In the case where the memory leak is detected, determining the target code causing the memory leak in all the codes of the electric power Internet of Things system; Analyze the target code to determine why the allocated memory in the memory is not released; According to the reason, a memory release code is added to the entire code, so as to release the allocated memory by using the memory release code.

10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the memory management method for the electric power Internet of Things system according to any one of claims 1 to 9.