Resource garbage recycling method and device, electronic equipment and storage medium

By monitoring the trigger method of resource garbage collection, determining the target recycling strategy and recycling referenced data, the problem of resource garbage collection that cannot be applied to resource electronic devices that support downloading process programming languages ​​is solved, and the effective recycling of resource garbage is achieved and adapt.

CN119088559APending Publication Date: 2024-12-06BEIJING CEC HUADA ELECTRONIC DESIGN CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411201257.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing resource recycling method cannot be applied to resource electronic devices that support operating systems that download applications written in process programming languages, resulting in the inability to effectively perform resource garbage collection.

Method used

By monitoring the triggering method of resource garbage collection, the target recycling strategy is determined, and the resources occupied by the referenced data to be recycled are identified and recycled, and recycling strategies of different triggering methods are adapted to achieve effective recycling of resource garbage.

Benefits of technology

It realizes resource garbage collection for application operating system resource electronic devices for support download process programming languages, solves the problem of resource inability to be recycled and improves the adaptability and efficiency of resource recycling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088559A_ABST
    Figure CN119088559A_ABST
Patent Text Reader

Abstract

The invention discloses a resource garbage recycling method and device, electronic equipment and a storage medium. Determining a target recycling strategy according to a trigger mode under the condition that any trigger mode of resource garbage recycling is monitored; and determining the reference data to be recycled by utilizing the target recycling strategy, recycling the resources occupied by the reference data to be recycled, and setting corresponding recycling strategies for different triggering modes, so that the resource electronic equipment which supports an operating system of an application written by a process-oriented programming language to be downloaded later can be used for recycling the resources. According to the method, the adaptation of resource garbage collection can be better carried out, and the problem that resource garbage collection cannot be carried out on the resource electronic equipment of the operating system which downloads the application written by the process programming language later is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a resource waste recycling method, device, electronic device and storage medium. Background Art

[0002] With the development of science and technology, electronic terminals are used more and more widely. People can install and delete various applications on electronic terminals to meet people's different functional needs. During the installation and deletion of applications, the resources of the electronic terminal will be continuously allocated and recycled.

[0003] Current resource electronic devices usually use operating systems that support post-download applications written in object-oriented programming languages, and their corresponding resource recovery methods are usually related to their data structures. For resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages, the existing resource recovery methods cannot be applied to resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages ​​because their data structures are different from those of the prior art. Summary of the invention

[0004] The present application provides a resource garbage recovery method, device, electronic device, terminal and storage medium to solve the resource garbage recovery problem of resource electronic devices of an operating system that supports post-download of applications written in a process-oriented programming language.

[0005] According to one aspect of the present application, a resource garbage collection method is provided, the method comprising:

[0006] When any triggering mode of resource garbage collection is detected, a target recycling strategy is determined according to the triggering mode;

[0007] The target recycling strategy is used to determine the reference data to be recycled, and the resources occupied by the reference data to be recycled are recycled.

[0008] According to another aspect of the present application, a resource garbage recovery device is provided, the device comprising:

[0009] A determination module, used to determine a target recycling strategy according to the triggering mode when any triggering mode of resource garbage collection is detected;

[0010] The recycling module is used to determine the reference data to be recycled by using the target recycling strategy, and to recycle the resources occupied by the reference data to be recycled.

[0011] According to another aspect of the present application, an electronic device is provided.

[0012] An embedded operating system is installed on the electronic device, and a runtime environment is executed in the embedded operating system. The electronic device includes:

[0013] at least one processor; and

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

[0015] 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 can execute the resource garbage collection method of any embodiment of the present application.

[0016] According to another aspect of the present application, a terminal is provided, comprising the electronic device of any embodiment of the present application.

[0017] According to another aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to implement the resource garbage collection method of any embodiment of the present application when executed.

[0018] According to another aspect of the present application, a computer program product is provided, characterized in that the computer program product includes a computer program, and when the computer program is executed by a processor, the resource garbage collection method of any embodiment of the present application is implemented.

[0019] The technical solution of the embodiment of the present application determines a target recycling strategy according to the triggering mode when any triggering mode of resource garbage collection is monitored; uses the target recycling strategy to determine the referenced data to be recycled, and recycles the resources occupied by the referenced data to be recycled. By setting corresponding recycling strategies for different triggering modes, resource garbage collection can be better adapted for resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages, thereby solving the problem that resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages ​​cannot perform resource garbage collection.

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

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

[0022] Figure 1 A flowchart of a resource garbage recycling method is provided for Embodiment 1 of the present application;

[0023] Figure 2 A flowchart of a resource garbage recycling method provided in Example 2 of the present application;

[0024] Figure 3 A flowchart of a resource garbage recycling method provided in Example 3 of the present application;

[0025] Figure 4 A flowchart of a resource garbage recycling method provided in Embodiment 4 of the present application;

[0026] Figure 5 A schematic diagram of the structure of a resource waste recycling device provided in Example 5 of the present application;

[0027] Figure 6 A schematic diagram of the structure of an electronic device that can be used to implement the embodiments of the present application is shown. DETAILED DESCRIPTION

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

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations 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.

[0030] Embodiment 1

[0031] Figure 1A flowchart of a resource waste recycling method is provided for the first embodiment of the present application. This embodiment is applicable to situations where resource waste needs to be recycled. The method can be executed by a resource waste recycling device. The resource waste recycling device can be implemented in the form of hardware and / or software. The resource waste recycling device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0032] Step 101: When any triggering mode of resource garbage collection is detected, a target recycling strategy is determined according to the triggering mode.

[0033] In this step, the resource garbage may be resources occupied by garbage data, wherein the garbage data may be redundant data that remains in the system after being deleted by an application, and the resources occupied by such data are usually various types of memory.

[0034] In addition, the triggering method may be any method that can prompt resource garbage collection, such as an instruction, or the value of some identification bits, etc.

[0035] Different triggering modes correspond to different recycling strategies. This embodiment may adopt a monitoring instruction mechanism. As long as a certain triggering mode is detected, the recycling process corresponding to the recycling strategy corresponding to the triggering mode is executed.

[0036] Step 102: Determine the reference data to be recycled using the target recycling strategy, and recycle the resources occupied by the reference data to be recycled.

[0037] In this step, the reference data to be recycled is the aforementioned garbage data, and this embodiment is to recycle the resources occupied by the garbage data.

[0038] In this embodiment, when any triggering mode of resource garbage collection is monitored, a target recycling strategy is determined according to the triggering mode; the target recycling strategy is used to determine the referenced data to be recycled, and the resources occupied by the referenced data to be recycled are recycled. By setting corresponding recycling strategies for different triggering modes, resource garbage collection can be better adapted for resource electronic devices with operating systems that support post-download of applications written in process-oriented programming languages, which solves the problem that resource electronic devices equipped with operating systems built in binary format cannot perform resource garbage collection.

[0039] Embodiment 2

[0040] Figure 2 This is a flowchart of a resource garbage collection method provided in the second embodiment of the present application. This embodiment is a lower-level embodiment of the above embodiment. This embodiment can be used to collect resource garbage in the scenario of deleting an application. Figure 2As shown, the method includes:

[0041] Step 201: periodically detect the value of the garbage collection start flag, and if the detected value of the position changes to a first preset value, determine that resource garbage collection is triggered in a first triggering manner.

[0042] In this step, the garbage collection start flag is a parameter in the system, and the bit value of the garbage collection start flag is the parameter value. When any target application is deleted, the bit value of the garbage collection start flag is set to the first preset value.

[0043] Specifically, after the target application is deleted, the garbage collection start flag may be set to a first preset value.

[0044] In this step, the bit value of the garbage collection start flag bit may be detected periodically. As long as it is detected that the bit value changes to the first preset value, it can be determined that resource garbage collection is triggered in the first triggering manner.

[0045] When detecting the change of the bit value, the bit value detected this time may be compared with the expected first preset value. If the bit value detected this time is the first preset value, it can be determined that the bit value is detected to be changed to the first preset value.

[0046] In order to shorten the total detection time of the bit value, that is, the total time of periodic detection of the bit value, this embodiment may start periodic detection of the bit value when an application deletion event is detected.

[0047] In a specific example, the first preset value may be "1", or, of course, may be other values ​​such as 0xA5.

[0048] Step 202: If the trigger mode is the first trigger mode, determine the traversal recycling strategy corresponding to the first trigger mode as the target recycling strategy.

[0049] In this step, the recycling strategy corresponding to the first trigger mode may be a traversal recycling strategy, which mainly realizes resource recycling by means of traversal. The specific process may refer to the following steps.

[0050] Step 203: Determine the reference data to be recycled using the target recycling strategy, and recycle the resources occupied by the reference data to be recycled.

[0051] Before traversing the reference values ​​in this step, this embodiment can perform an initialization operation on the starting address of the heap space and the total size of the space to be released. It should be noted that the initialization operation is to return the starting address of the heap space and the total size of the space to be released to 0, and both are assigned to 0. Further, the number of reference data to be deleted can also be initialized, for example, the number of reference data to be deleted is returned to 0.

[0052] The starting address of the heap space and the total size of the space to be released are predefined parameters, which are mainly used to record some key information required for recycling. The assignment and use of these two parameters will be involved in the subsequent steps, which will not be repeated here. Furthermore, the number of reference data to be deleted can also be set as a predefined parameter.

[0053] After the initialization operation is completed, the reference value of the reference data storage area can be traversed first; each time a reference value is traversed, it is determined whether the reference data corresponding to the reference value is the reference data to be recycled; if so, the resources occupied by the reference data to be recycled are recycled.

[0054] It should be noted that when traversing based on the reference value of the reference data storage area, the traversal can start from the smallest reference value in the storage area allocated for the reference data, and then the reference value is incremented, so that all reference data can be traversed.

[0055] The increment in the incrementing process is related to the definition of the reference value in the system. In a specific example, the increment may be 1, and the reference value may be incremented by 1.

[0056] When traversing to any reference value, the table entry of the corresponding reference table can be indexed according to the reference value, and the starting address of the referenced data in the heap space can be located according to the table entry value of the table entry; then, based on the starting address, the attribute information of the referenced data is read; if the attribute information stores the identifier of the target application, the referenced data is determined as the referenced data to be recycled; otherwise, traversal of the next reference value is performed.

[0057] It should be noted that the data structure of the reference table can refer to the relevant technology and will not be described here. In this embodiment, based on the index characteristics between the reference value and the reference table entry, the reference value can be used to index the corresponding entry in the reference table, and the entry value can locate the starting address of the corresponding reference data in the heap space.

[0058] Since the starting address is the starting address where the corresponding reference data is stored in the heap space, after obtaining the starting address, the corresponding reference data stored in the heap space can be accessed based on the starting address.

[0059] When determining whether the reference data is reference data to be recycled, usually only the attribute information of the application data, that is, the reference data management information or header information, is needed. Therefore, this embodiment can directly read the attribute information.

[0060] The attribute information usually includes the identifier of the application to which it belongs. Therefore, this embodiment can determine whether the attribute information includes the identifier of the target application. If so, the reference data can be determined as reference data to be recycled; if not, the next reference value is traversed.

[0061] When reclaiming the resources occupied by the referenced data to be reclaimed, in order to improve the efficiency of resource recycling, the entire block of memory can be accumulated and then recycled.

[0062] Specifically, it can be determined whether the heap space address of the referenced data to be reclaimed currently traversed is continuous with the heap space address of the referenced data to be reclaimed last traversed. If the heap space address of the referenced data to be reclaimed currently traversed is continuous with the heap space address of the referenced data to be reclaimed last traversed, the address size of the referenced data to be reclaimed in the heap space is accumulated to the total size of the released space to merge the released space, and the resources are not reclaimed immediately.

[0063] Furthermore, the number of reference data to be deleted may be accumulated by 1 to merge the released space.

[0064] If the heap space address of the referenced data to be reclaimed currently traversed is not continuous with the heap space address of the referenced data to be reclaimed in the previous traversal, resources are immediately reclaimed, that is, resources are reclaimed for the corresponding heap space according to the starting address of the heap space and the total size of the space to be released, and initialization operations are performed. Furthermore, resources can also be reclaimed for the corresponding heap space according to the number of referenced data to be deleted, and initialization operations are performed.

[0065] After the resource is recycled, the starting address of the heap space address of the currently traversed reference data to be recycled is written into the initialization starting address of the heap space, and the total size of the space to be released is added to the address size of the currently traversed reference data to be recycled in the heap space. Furthermore, the number of reference data to be deleted can be added by 1.

[0066] It should be noted that the recycling process here utilizes the two parameters initialized above. For ease of description, this embodiment starts with the first reference data to be recycled that is traversed.

[0067] When the first reference data to be recycled is traversed, the starting address of the reference data to be recycled is used as the parameter value, and assigned to the parameter of the starting address of the heap space, and the size of the reference data to be recycled is added to the parameter of the total size of the space to be released. Furthermore, it is also possible to consider adding 1 to the parameter of the number of reference data to be deleted.

[0068] When traversing to the second reference data to be recycled, first determine whether the address in the heap space is continuous with the first reference data to be recycled. If continuous, the address size of the second application data to be recycled is added to the parameter of the total size of the space to be released. Furthermore, the parameter of the number of reference data to be deleted can be added by 1. The parameter of the starting address of the heap space mentioned above is no longer assigned here.

[0069] And so on, until the Nth reference data to be recycled is traversed, and the address of the Nth reference data to be recycled in the heap space is not continuous with the address of the N-1th reference data to be recycled. At this time, the corresponding heap space can be merged and released according to the above two parameters.

[0070] Of course, it is understandable that the second reference data to be reclaimed that may be traversed may not have a continuous address in the heap space with the first reference data to be reclaimed. In this case, the corresponding heap space can be released directly based on the first reference data to be reclaimed.

[0071] Specifically, the heap space starting address indicates the starting position of the heap space to be reclaimed, and the total size of the space to be released indicates the size of the heap space to be reclaimed. Therefore, starting from the starting position, the heap space size can be released to complete the resource recovery of this part of the heap space.

[0072] Since the addresses of the Nth reference data to be recycled are not continuous with the N-1th reference data to be recycled, after the above release is completed, the initialization operation can be continued again, and then the starting address of the Nth reference data to be recycled is used as the parameter value, and assigned to the parameter of the starting address of the heap space, and the size of the Nth reference data to be recycled is added to the parameter of the total size of the space to be released. Then continue to traverse. Furthermore, before continuing to traverse, the parameter of the number of reference data to be deleted can also be accumulated by 1.

[0073] In addition, each time a reference data to be recycled is determined, the table entry data in the reference table can be cleared based on the reference value of the reference data to be recycled. Specifically, the reference table entry corresponding to the reference value can be directly cleared. In order to ensure that the reference table can be used normally, in this embodiment, if the reference table is a first-level table, the number of valid table entries recorded in the reference table is decremented by 1; if the reference table is a second-level table, the number of valid table entries in the first-level reference table recorded in the 0th-level reference table of the reference table is decremented by 1; if the reference table is a second-level table and the number of valid table entries in the first-level subtable recorded in the 0th-level table of the second-level table is 0, the first-level subtable space of the reference table is released.

[0074] It should be noted that the relationship between the first-level table, the second-level table and the zero-level table can be referred to in the relevant technology and will not be repeated here.

[0075] After all reference data are traversed, that is, after all reference values ​​are traversed, the garbage collection start flag bit value can be set to a second preset value to indicate that garbage collection is completed. The second preset value can be, but is not limited to, "0".

[0076] In the above process, the garbage data remaining after the application is deleted, that is, the heap space resources occupied by the reference data to be recycled can be recycled.

[0077] Embodiment 3

[0078] Figure 3 This is a flowchart of a resource garbage collection method provided in the third embodiment of the present application. This embodiment is a further embodiment of the above-mentioned second embodiment. This embodiment can be used to recycle temporary static variable data (static transient resource, ASR) space and temporary dynamic variable data (dynamic transient resource, ADR) space in the scenario of deleting an application. Figure 3 As shown, the method includes:

[0079] Step 301: After determining the reference data as reference data to be recycled, if the reference data to be recycled is ASR data, set the ASR space compression flag to a third preset value; if the reference data to be recycled is ADR data, set the ADR space compression flag to a fourth preset value according to the application to which the reference data to be recycled belongs.

[0080] In this step, ASR data is temporary static variable data, which is usually used to store data related to a specific session or transaction to ensure security and data isolation. ADR data is temporary dynamic variable data, which is usually used to store temporary data or sensitive data within the application, such as temporary counters, caches, etc.

[0081] Among them, the ASR space compression flag and the ADR space compression flag are pre-set parameters, and by setting the corresponding values, it can be determined whether ASR space compression and ADR space compression are required in the future.

[0082] It should be noted that the third preset value can be but is not limited to "1". Since the ADR space is related to whether the application is selected, the fourth preset value needs to be set in combination with the application to which the referenced data to be recovered belongs. For example, it can be set to two parts. The first part is used to reflect the set state of the identifier, and the second part is the identifier of the application. The first part can be but is not limited to the value of "1".

[0083] Step 302: After traversing all reference values, determine whether the ASR space compression flag is the third preset value, and determine whether the ADR space compression flag is the fourth preset value.

[0084] In this step, judging whether the ADR space compression mark is the fourth preset value is mainly to judge whether the first part of the ADR space compression mark is the fourth preset value.

[0085] Step 303: If the ASR space compaction flag is the third preset value or the ADR space compaction flag is the fourth preset value, compact the ASR space and the ADR space in the memory space.

[0086] In this step, the current ADR space allocation information and the ASR space allocation information are first initialized, and then the reference data can be traversed. Each time a reference data is traversed, it is determined whether the reference data is ASR data or ADR data.

[0087] If the referenced data is ASR data, reallocate ASR space for the ASR data. Specifically, first obtain the size of the current ASR data, and apply for ASR space based on the size of the ASR data to obtain the first address space; obtain the first address space after the ASR data is reallocated and the second address space of the original array element; determine whether the first address space and the second address space are consistent; if not, migrate the array elements of the second address space to the first address space, and update the ASR space in the attribute information of the ASR data to the first address space; if consistent, do not perform the migration operation and the update operation.

[0088] Since only part of the ASR data is deleted during the application deletion process, only part of the entire ASR space may be free, and the free space may exist in the middle, starting or end of the ASR space.

[0089] Therefore, for the traversed ASR data, the re-applied first address space and the second address space of the original array elements of the ASR data can be compared for consistency. If they are consistent, it means that the space released by the deleted ASR data has no impact on the ASR data traversed this time, and there is no need to perform migration and update operations. If they are inconsistent, it means that the space released by the deleted ASR data has an impact on the ASR data traversed this time, and migration and update operations are required, that is, the array elements of the second address space are migrated to the first address space, and the ASR space in the attribute information of the ASR data is updated to the first address space.

[0090] If the referenced data is ADR data, obtain the identifier of the application to which the ADR data belongs, and reallocate the ADR space for the ADR data based on the identifier of the application to which it belongs. Specifically, the size of the current ADR data can be obtained, and the ADR space can be applied for based on the size of the ADR data to obtain the third address space; obtain the third address space of the array elements after the ADR data reallocates the space and the fourth address space of the original array elements; determine whether the third address space and the fourth address space are consistent; if not, update the ADR space in the attribute information of the ADR data to the third address space information, and determine whether other applications in the same creation module as the application to which the ADR data belongs are selected on the logical channel based on the attribute information of the application to which it belongs; if selected, migrate the array elements of the fourth address space to the third address space, and if not selected, do not perform the migration operation; if consistent, do not perform the migration operation and the update operation.

[0091] Since only selected applications will occupy ADR space, and applications of the same module are usually in the same ADR space, for the compaction of ADR space, based on the determination that the third address space and the fourth address space are inconsistent, it is also possible to add whether other applications belonging to the same module are selected. If they are selected, migration operations are performed. If they are not selected, no migration is required.

[0092] In addition, in the present embodiment, the operations of compacting the ASR space and the ADR space in the memory space are completed in one transaction. Before performing the traversal of the present embodiment, the ADR data of the selected application on the logical channel and all ASR data can be backed up; and in the event of an abnormality in the compaction operation, the backed-up ADR data and all ASR data can be rolled back to the state before the compaction.

[0093] Embodiment 4

[0094] Figure 4This is a flowchart of a resource garbage collection method provided in the fourth embodiment of the present application. This embodiment is a lower-level embodiment of the above-mentioned first embodiment. This embodiment can be used to collect resource garbage in the scenario where the application part references data. Figure 4 As shown, the method includes:

[0095] Step 401: If it is detected that the space release API interface is called by the application, it is determined that resource garbage collection is triggered in a second triggering manner.

[0096] In this step, when deleting part of the reference data of the application, it is necessary to call the space release API interface, and parameter information will be passed during the call, and the parameter information includes the reference value of the reference data to be deleted.

[0097] Step 402: If the trigger mode is the second trigger mode, determine the partial recycling strategy corresponding to the second trigger mode as the target recycling strategy.

[0098] In this step, the second triggering mode corresponds to a partial recycling strategy. Different from the aforementioned traversal recycling strategy, this step does not involve traversal, but rather direct deletion with a target.

[0099] Step 403: Determine the reference data to be reclaimed using the target reclaim strategy, and reclaim the resources occupied by the reference data to be reclaimed.

[0100] In this step, the call information when calling the space release API interface is obtained, and the target reference value is extracted from the call information; the reference data corresponding to the target reference value is determined as the reference data to be recycled, and the resources occupied by the reference data to be recycled are recycled.

[0101] Among them, the resource recovery of the heap space occupied by it can refer to the aforementioned embodiment part, which will not be repeated here. For the clearing of table entries, this embodiment can also clear the reference table entries corresponding to the target reference value; if the reference table is a secondary table, the number of valid table entries in the first-level reference table recorded in the 0-level reference table of the reference table is reduced by 1; if the reference table is a secondary table and the number of valid table entries of the first-level sub-table recorded in the 0-level table of the secondary table is 0, the space of the first-level sub-table corresponding to the reference table is released.

[0102] Embodiment 5

[0103] Figure 5 This is a schematic diagram of the structure of a resource garbage recycling device provided in Example 5 of the present application. Figure 3 As shown, the device comprises:

[0104] The determination module 501 is used to determine the target recycling strategy according to the trigger mode when any trigger mode of resource garbage collection is detected;

[0105] The recycling module 502 is used to determine the reference data to be recycled by using the target recycling strategy, and to recycle the resources occupied by the reference data to be recycled.

[0106] In this embodiment, when any triggering mode of resource garbage collection is monitored, a target recycling strategy is determined according to the triggering mode; the target recycling strategy is used to determine the referenced data to be recycled, and the resources occupied by the referenced data to be recycled are recycled. By setting corresponding recycling strategies for different triggering modes, resource garbage collection can be better adapted for resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages, thereby solving the problem that resource electronic devices with operating systems that support post-download applications written in process-oriented programming languages ​​cannot perform resource garbage collection.

[0107] Embodiment 6

[0108] Figure 6 A schematic diagram of the structure of an electronic device that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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 application described and / or required herein.

[0109] In this embodiment, the electronic device may also include a restricted device, which is a resource-restricted device, referring to some devices with very limited hardware resources, such as memory resources, etc. Further, the restricted device may be a smart card, a secure element SE or an embedded device.

[0110] 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.

[0111] 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.

[0112] 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 a resource garbage collection method.

[0113] In some embodiments, the resource garbage collection 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 resource garbage collection method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the resource garbage collection method in any other appropriate manner (e.g., by means of firmware).

[0114] 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.

[0115] The computer programs for implementing the methods of the present application 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 programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0116] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction 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.

[0117] 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).

[0118] 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.

[0119] 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.

[0120] Embodiment 7

[0121] Embodiment 7 of the present application provides a terminal, which includes the electronic device provided in Embodiment 6.

[0122] Embodiment 8

[0123] Embodiment 8 of the present application provides a computer-readable storage medium, which stores computer instructions. The computer instructions are used to enable a processor to implement the resource garbage collection method of any embodiment of the present application when executed.

[0124] Embodiment 9

[0125] Embodiment 9 of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the resource garbage collection method provided in any embodiment of the present application.

[0126] 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 recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution of this application can be achieved, and this document is not limited here.

[0127] The above specific implementations do not constitute a limitation on the protection scope of this application. 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 modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A resource garbage recycling method, characterized in that: The method comprises: When any triggering mode of resource garbage collection is detected, a target recycling strategy is determined according to the triggering mode, wherein different recycling strategies correspond to different triggering modes; The target recycling strategy is used to determine the reference data to be recycled, and the resources occupied by the reference data to be recycled are recycled.

2. The method according to claim 1, characterized in that If the triggering mode is the first triggering mode, the step of determining the reference data to be recycled by using the target recycling strategy and recycling the resources occupied by the reference data to be recycled includes: Traverse based on the reference value of the reference data store; Each time a reference value is traversed, determining whether the reference data corresponding to the reference value is reference data to be recycled; If so, the resources occupied by the referenced data to be recycled are recycled.

3. The method according to claim 2, characterized in that The method further comprises: When deleting any target application, setting the bit value of the garbage collection start flag bit to a first preset value; The determining whether the reference data corresponding to the reference value is reference data to be recycled includes: Indexing a table entry of a corresponding reference table according to the reference value, and locating a starting address of the referenced data in the heap space according to the table entry value of the table entry; Based on the starting address, reading the attribute information of the reference data; If the identifier of the target application is stored in the attribute information, the reference data is determined as reference data to be recycled; Otherwise, proceed to traverse the next reference value.

4. The method according to claim 3, characterized in that After determining the reference data as reference data to be recycled, the method further includes: If the reference data to be recycled is ASR data, setting the ASR space compaction flag to a third preset value; If the reference data to be recycled is ADR data, the ADR space compaction flag is set to a fourth preset value according to the application to which the reference data to be recycled belongs.

5. The method according to claim 4, characterized in that The step of recycling the resources occupied by the referenced data to be recycled further includes: After traversing all reference values, determining whether the ASR space compaction flag is a third preset value, and determining whether the ADR space compaction flag is a fourth preset value; If the ASR space compaction flag is the third preset value or the ADR space compaction flag is the fourth preset value, the ASR space and the ADR space in the memory space are compacted.

6. The method according to any one of claims 1 to 5, characterized in that: If the triggering mode is the second triggering mode, the step of determining the reference data to be recycled by using the target recycling strategy and recycling the resources occupied by the reference data to be recycled includes: Acquire call information when calling the free space API interface, and extract the target reference value from the call information; The reference data corresponding to the target reference value is determined as the reference data to be recycled, and the resources occupied by the reference data to be recycled are recycled.

7. A resource waste recycling device, characterized in that: The device comprises: A determination module, configured to determine a target recycling strategy according to any triggering mode of resource garbage collection when any triggering mode of resource garbage collection is detected; The recycling module is used to determine the reference data to be recycled by using the target recycling strategy, and to recycle the resources occupied by the reference data to be recycled.

8. An electronic device, characterized in that: The electronic device is installed with an embedded operating system, in which a runtime environment is executed, and the electronic device comprises: at least one processor; and 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 can execute the resource garbage collection method according to any one of claims 1 to 6.

9. The electronic device according to claim 8, characterized in that The electronic device comprises a resource-constrained device.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource garbage collection method according to any one of claims 1 to 6 when executed.

Citation Information

Cited By

  • Memory chip testing method and device and electronic equipment

    CN120932713A