Methods, apparatuses, systems, electronic devices and storage media for processing objects

CN122570026APending Publication Date: 2026-08-14SHENZHEN KANGYOU HEALTH TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-25
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]鉴于以上问题,本申请实施例提供一种对象的处理方法、装置、系统、电子设备及存储介质,以解决上述不利于提高内存效率以及应用程序的运行性能的技术问题

Benefits of technology

[0010]本申请实施例提供的对象的处理方法、装置、系统、电子设备及存储介质,通过第一对象池和第二对象池,第一对象池用于对可复用的休眠对象进行暂存,第二对象池用于对使用对象进行存储,无需频繁创建及销毁使用对象;并且,当监测到内存压力值大于或等于第一预设阈值时,清空第一对象池,通过设置内存压力感知与释放能力,实现了在内存紧张时主动、智能地释放资源以确保内存安全,以及在内存充裕时灵活扩展第二对象池以提升复用率,有利于提高内存效率以及应用程序的运行性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122570026A_ABST
    Figure CN122570026A_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology, and more particularly to a method, apparatus, system, electronic device, and storage medium for processing objects. The object processing method, apparatus, electronic device, and storage medium provided in the embodiments of this application utilize a first object pool and a second object pool. The first object pool is used to temporarily store reusable dormant objects, and the second object pool is used to store objects in use, eliminating the need for frequent creation and destruction of objects in use. Furthermore, when the detected memory pressure value is greater than or equal to a first preset threshold, the first object pool is cleared. By setting memory pressure sensing and release capabilities, resources are proactively and intelligently released to ensure memory safety when memory is scarce, and the second object pool is flexibly expanded to improve reuse rate when memory is abundant, which is beneficial for improving memory efficiency and application performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, system, electronic device, and storage medium for processing objects. Background Technology

[0002] During application development or operation, multiple objects need to be created in memory, such as dynamically created view components (e.g., TextView), bitmap objects (e.g., Bitmap), and various custom business objects. When an object is no longer needed, it is destroyed using the garbage collection mechanism to reclaim memory. However, frequent object creation and destruction operations can easily cause drastic fluctuations in memory usage, known as "memory thrashing," which in turn leads to the garbage collection mechanism running at high frequency. This not only competes for main thread resources, causing user interface rendering to be blocked or stuttered, but in extreme cases, it can also trigger an OutOfMemoryError (OOM) error because a large number of objects cannot be reclaimed in time, causing the application to crash.

[0003] Currently, to alleviate the above problems, an object pool pattern is commonly used to manage the caching of some reusable objects. However, the following issues still exist: First, object pools typically lack memory state awareness and cannot dynamically adjust caching strategies based on real-time system memory pressure. Second, object pool capacity and reclamation mechanisms are often static or pre-configured, unable to proactively and intelligently release resources when memory is scarce, nor can they flexibly expand to improve reusability when memory is plentiful. Therefore, this is detrimental to improving memory efficiency and application performance. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide a method, apparatus, system, electronic device and storage medium for processing objects, so as to solve the above-mentioned technical problems that are not conducive to improving memory efficiency and application running performance.

[0005] In a first aspect, embodiments of this application provide a method for processing an object, including: In response to the creation operation of the target object, it is determined whether there is a dormant object in the first object pool, wherein the first object pool is used to store at least one dormant object with the same object type as the target object to be created; If so, when the detected memory pressure value is less than the first preset threshold, the hibernation object is obtained from the first object pool, the target usage object is generated based on the hibernation object, and the target usage object is stored in the second object pool, wherein the second object pool is used to store at least one usage object with the same object type as the target usage object; When the detected memory pressure value is greater than or equal to the first preset threshold, the dormant objects in the first object pool are cleared to reclaim memory.

[0006] Secondly, embodiments of this application provide an object processing apparatus, comprising: The determination module is used to determine whether a dormant object exists in a first object pool in response to a creation operation that creates a target object; wherein the first object pool is used to store at least one dormant object with the same object type as the target object to be created. A creation module is configured to, if the detected memory pressure value is less than a first preset threshold, retrieve the hibernation object from the first object pool, generate the target usage object based on the hibernation object, and store the target usage object in a second object pool, wherein the second object pool is used to store at least one usage object of the same object type as the target usage object; The memory monitoring module is used to clear the hibernating objects in the first object pool to reclaim memory when the detected memory pressure value is greater than or equal to a first preset threshold.

[0007] Thirdly, embodiments of this application provide an object processing system, including: The memory monitoring module is used to obtain the current available memory or the current used memory, and to obtain the memory pressure value based on the current available memory or the current used memory. The object factory module is used to create dormant objects; generate user objects from dormant objects; and generate dormant objects from user objects.

[0008] Fourthly, embodiments of this application provide an electronic device, the electronic device including a processor and a memory coupled to the processor, the memory storing program instructions executable by the processor; when the processor executes the program instructions stored in the memory, it implements the above-described object processing method.

[0009] Fifthly, embodiments of this application provide a computer-readable storage medium storing program instructions that, when executed by a processor, implement the above-described object processing method.

[0010] The object processing method, apparatus, system, electronic device, and storage medium provided in this application embodiment utilize a first object pool and a second object pool. The first object pool is used to temporarily store reusable dormant objects, while the second object pool is used to store objects in use, eliminating the need for frequent creation and destruction of objects in use. Furthermore, when the detected memory pressure value is greater than or equal to a first preset threshold, the first object pool is cleared. By setting memory pressure sensing and release capabilities, resources are proactively and intelligently released to ensure memory safety when memory is tight, and the second object pool is flexibly expanded to improve reuse rate when memory is sufficient, which is beneficial for improving memory efficiency and application performance.

[0011] These or other aspects of this application will become more apparent from the description of the following embodiments. Attached Figure Description

[0012] Figure 1 The diagram illustrates an application scenario of the object processing method provided in the embodiments of this application.

[0013] Figure 2 A flowchart illustrating the object processing method provided in an embodiment of this application is shown.

[0014] Figure 3 A schematic diagram of the object processing system in the object processing method provided in the embodiments of this application is shown.

[0015] Figure 4 A schematic diagram of the structure of the object processing apparatus provided in the embodiments of this application is shown.

[0016] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown.

[0017] Figure 6 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of this application is shown. Detailed Implementation

[0018] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0019] To enable those skilled in the art to better understand the solutions of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0020] In the embodiments of this application, it should be noted that, in this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0021] Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0022] In the description of the embodiments of this application, the words "example" or "for example" are used to indicate exemplification, illustration, or description. Any embodiment or design described as "example" or "for example" in the embodiments of this application is not to be construed as being more preferred or having more advantages than another embodiment or design. The use of the words "example" or "for example" is intended to present relative concepts in a clear manner.

[0023] Furthermore, in the embodiments of this application, "multiple" refers to two or more. Therefore, in the embodiments of this application, "multiple" can also be understood as "at least two". "At least one" can be understood as one or more, such as one, two, or more. For example, including at least one means including one, two, or more, and is not limited to which ones are included. For example, including at least one of A, B, and C, then it could include A, B, C, A and B, A and C, B and C, or A and B and C.

[0024] It should be noted that in the embodiments of this application, "and / or" describes the relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. In addition, the character " / ", unless otherwise specified, generally indicates that the associated objects before and after it are in an "or" relationship.

[0025] It should be noted that in the embodiments of this application, "connection" can be understood as electrical connection. The connection between two electrical components can be a direct or indirect connection between the two electrical components. For example, the connection between A and B can be a direct connection between A and B, or an indirect connection between A and B through one or more other electrical components.

[0026] The object processing method provided in this application can be applied to... Figure 1 The mobile terminal 100 shown includes a memory 101. The mobile terminal 100 has at least one application and a program for implementing object processing methods. When the application runs, the program for implementing object processing methods is run to process objects during the application's operation.

[0027] One embodiment of this application provides a method for processing objects. Please refer to [link / reference]. Figure 2 As shown, the object processing method in this embodiment includes the following steps S11 to S13: Step S11: In response to the creation operation of the target object, determine whether there is a dormant object in the first object pool, wherein the first object pool is used to store at least one dormant object with the same object type as the target object to be created.

[0028] The object can be one used during application development or one used during application runtime. During application development or use, the application creates and manipulates this object in memory; this object can be a core entity with defined state and behavior.

[0029] Each object has a specific object type, which serves as a template for object creation. For example, an object can have a type name (such as String, Bitmap, User). The type name is unique and represents the operations that the object can perform, such as the methods / functions that the object can provide. Different object types have different creation functions. In application development, objects are the instantiation results of classes. Developers create objects of different object types (such as a Button object, a User object, and a NetworkRequest object) and make them work together to implement complex application logic.

[0030] In this context, "used objects" refer to objects held and directly used by the application, representing entities currently being operated on by the business logic; in other words, they are objects in use. "Dormant objects," on the other hand, are objects that have been created but are not currently used by any application's business logic; they are in a cached state. When a used object needs to be created, it doesn't need to start from the initial steps; instead, the dormant object can be processed to form a used object. After a used object is used by the application, it doesn't need to be directly recycled; instead, it can be processed again to form a dormant object, which awaits reuse.

[0031] The creation operation can be a user-triggered function, such as clicking a function button on a page or swiping through a window. It can also be a code-writing instruction sent by a developer to create an object. The first object pool can be an in-memory container used to store dormant objects. For example, multiple first object pools of different object types can exist in memory, each storing a dormant object of a specific object type. When a creation operation to create a target object is received, the system can select a first object pool with the same object type as the target object and determine if a dormant object exists in that pool. For example, dormant objects can be stored in the first object pool in the form of a queue.

[0032] Step S12: If yes, when the detected memory pressure value is less than the first preset threshold, a dormant object is obtained from the first object pool, a target user object is generated based on the dormant object, and the target user object is stored in the second object pool, wherein the second object pool is used to store at least one user object with the same object type as the target user object.

[0033] The first object pool contains dormant objects. A dormant object is retrieved from the first object pool and used to generate a target object for use, thus achieving the reuse of dormant objects. The second object pool can be an in-memory container used to store objects for use. The second object pool can be understood as an active object pool. For example, multiple second object pools with different object types can exist in memory, each used to store an object for a specific object type. For example, objects for use can be stored in the second object pool in the form of key-value pairs. The key represents the creation operation or the application's business logic, and the value represents an instance of the object for use.

[0034] By setting up a first object pool and a second object pool, the first object pool is used to temporarily store reusable dormant objects, and the second object pool is used to store objects in use. This achieves physical isolation between dormant objects and objects in use. Furthermore, dormant objects can be reused as objects in use, eliminating the need for frequent creation and destruction of objects in use. This reduces the likelihood of drastic fluctuations in memory usage, avoids frequent creation and destruction of objects in use that could compete for main thread resources, prevents memory overflow errors, and improves the stability of the application.

[0035] The memory pressure value is used to characterize the amount of memory occupied. If the memory pressure value is less than the first preset threshold, it means that the memory has not been occupied in large quantities and the dormant objects can continue to be cached in the first object pool.

[0036] During the process of obtaining the target object, if it is determined that there is a dormant object in the first object pool and the memory pressure value is less than the first preset threshold, a dormant object is obtained from the first object pool, the obtained dormant object is converted into the target object and stored in the second object pool.

[0037] Step S13: When the memory pressure value is detected to be greater than or equal to the first preset threshold, clear the dormant objects in the first object pool to reclaim memory.

[0038] The memory pressure value is used to characterize the amount of memory occupied. If the memory pressure value is greater than or equal to the first preset threshold, it means that a large amount of memory has been occupied. Continuing to cache dormant objects is not conducive to improving memory efficiency. Clearing dormant objects in the first object pool and releasing the redundant resources occupied by dormant objects effectively alleviates memory pressure, thereby reducing the risk of application crash (OOM) caused by memory exhaustion.

[0039] During the process of obtaining the target object, if it is determined that there are dormant objects in the first object pool and the memory pressure value is greater than or equal to the first preset threshold, the memory occupied by the dormant objects in the first object pool is reclaimed by clearing them.

[0040] If the memory pressure value is less than the first preset threshold, it means that the memory is not being used in large quantities and the memory is relatively abundant. Retaining more dormant objects in the first object pool helps to improve the reuse rate of dormant objects and make the application run more efficiently.

[0041] In this embodiment, a first object pool and a second object pool are used. The first object pool is used to temporarily store reusable dormant objects, and the second object pool is used to store objects in use, eliminating the need for frequent creation and destruction of objects in use. Furthermore, when the memory pressure value is detected to be greater than or equal to a first preset threshold, the first object pool is cleared. By setting the memory pressure sensing and release capability, resources are proactively and intelligently released to ensure memory safety when memory is tight, and the second object pool is flexibly expanded to improve the reuse rate when memory is sufficient, which is beneficial to improving memory efficiency and application performance.

[0042] As one implementation method, in step S12, generating a target user object based on the hibernation object includes the following steps: Step S12a: Replace the initial general data of the dormant object with the business data corresponding to the creation operation, and associate the unique identifier of the creation operation with the dormant object to generate the target user object.

[0043] The dormant object is a general, initial, or empty state, not bound to any specific business logic instance, and is a general resource waiting to be assigned business logic; the data in the dormant object is initial general data, which may include initial parameters and / or initial state. For example, the initial parameters can be empty, and the initial state can also be empty.

[0044] The object being used is a specific, business-oriented state, bound to a specific business logic. It is the in-memory embodiment of that specific business logic and is generated based on a specific business request. This business logic is executed by the application at runtime and has a unique identifier; the unique identifier of the creation operation is the unique identifier of the corresponding business logic. Business data may include business parameters and / or business states. The unique identifier of the creation operation is associated with the dormant object, forming a key-value pair. Business data is used to replace the initial general data to write the business data into the dormant object. After this processing, the dormant object is transformed into a user object, i.e., the target user object. The unique identifier allows for quick lookup and retrieval of the target user object.

[0045] In this embodiment, a relationship is established by writing business data and a unique identifier of the business logic that triggers the creation operation. The dormant object obtained from the first object pool is generated as the target object, which helps to improve the generation speed of the target object.

[0046] As one implementation method, the object processing method of this embodiment further includes the following steps: Step S21: In response to the recycling operation of returning the target object, retrieve the target object from the second object pool; Step S22: When the detected memory pressure value is less than the first preset threshold, the target object is reset to obtain a hibernation object, and the hibernation object is stored in the first object pool.

[0047] During the recycling process of the target object, if the memory pressure value is detected to be less than the first preset threshold, the target object is converted into a dormant object and stored in the first object pool.

[0048] In this embodiment, when the target object is no longer in use, it needs to be recycled. The target object is retrieved from the second object pool, reset as a dormant object, and stored again in the first object pool to achieve the reuse of the dormant object.

[0049] In some implementations, after step S21, the following steps are also included: Step S23: When the detected memory pressure value is greater than or equal to the first preset threshold, delete the acquired target object and clear the dormant objects in the first object pool to reclaim memory.

[0050] During the recycling process of the target object, if the memory pressure value is detected to be greater than or equal to the first preset threshold, since it is no longer necessary to recycle the target object to the first object pool, the acquired target object is directly deleted and the dormant objects in the first object pool are cleared.

[0051] In some implementations, step S21 involves resetting the target object to obtain a dormant object, specifically including the following steps: Step S31: Remove the association between the target object and the unique identifier of the creation operation, and replace the business data corresponding to the creation operation in the target object with the initial general data to obtain the dormant object.

[0052] Specifically, the binding between the target object and the unique identifier of the creation operation is removed, the specific key and its reference to the value are removed from the mapping structure, the key can no longer access the value through this mapping, the mapping relationship is destroyed, that is, the association between the target object and the corresponding business logic is removed, and the business data in it is reset to restore it to a general, initial or empty state, not bound to any specific business logic instance, and is a general resource waiting to be allocated business logic.

[0053] Specifically, when a reset command for the target object is detected, step S31 is executed to reset the target object and generate a dormant object. The reset command for the target object can be triggered by a user action, such as a TextView object being slid off the screen display area; or it can be triggered by the completion of business logic execution, such as a Response object processing a network request, where the network request processing is completed.

[0054] As one implementation method, the object processing method of this embodiment further includes the following steps: Step S41: Obtain the current available memory or the current used memory, and obtain the memory pressure value based on the current available memory or the current used memory.

[0055] The higher the amount of memory currently used, the greater the memory pressure value; conversely, the lower the amount of memory currently available, the greater the memory pressure value. The system can detect both the amount of memory currently available to represent memory pressure and the amount of memory currently used to represent memory pressure.

[0056] For example, in a standard Java application, the JVM heap memory usage can be obtained through the Runtime class.

[0057] In some implementations, the memory pressure value can be the amount of memory currently used, and the first preset threshold can be a memory usage threshold. The amount of memory currently used is greater than or equal to the memory usage threshold, that is, the memory pressure value is greater than or equal to the first preset threshold.

[0058] In some implementations, the memory pressure value can be the percentage of currently used memory relative to the total memory, and the first preset threshold can be a memory utilization threshold.

[0059] Therefore, when monitoring the amount of memory currently used, the memory pressure value can be determined based on the ratio of the currently used memory to the total memory. In other words, the memory pressure value is the ratio of the currently used memory to the total memory.

[0060] When monitoring the amount of currently available memory, the memory utilization rate can be determined based on the ratio of the current available memory to the total memory, and the memory pressure value can be obtained based on the difference between 1 and the memory utilization rate.

[0061] As one implementation method, the object processing method of this embodiment further includes the following steps: Step S51: When an initialization creation instruction for creating a hibernation object is received, an initial hibernation object is created according to the object type, and a first object pool is created according to the object type; Step S52: Write the initial general data of the corresponding object type into the initial dormant object to obtain the dormant object, and store the dormant object in the first object pool.

[0062] The initialization creation instruction can be generated when the application starts, or it can be generated during the system startup process after power-on. For example, for objects with high creation costs and high usage frequency, such as complex custom Views, product card ViewHolders, and bullet screen components, the initialization creation instruction can be generated during the system startup process after power-on, or the initialization creation instruction can be generated when the application starts.

[0063] The initialization creation instruction can be generated when the application executes the corresponding business logic. For example, for objects with low creation cost or low usage frequency, such as simple Strings, POJO data models, and lightweight Views, the initialization creation instruction can be generated and created when the application executes the corresponding business logic.

[0064] As one implementation method, the object processing method of this embodiment further includes the following steps: Step S61: If yes, create a dormant object based on the object type of the target object, generate the target object based on the dormant object, and store the target object in the second object pool.

[0065] If the first object pool is empty, a new dormant object is created, and then the target object is created using the dormant object.

[0066] In some implementations, please refer to Figure 3 As shown, the object processing system 200 includes a memory monitoring module 201 and an object factory module 202. The memory monitoring module 201 is used to obtain the current available memory or the current used memory, and the object factory module 202 is used to create dormant objects, generate used objects based on dormant objects, and generate dormant objects based on used objects.

[0067] The object factory module 202 includes object creation functions, object retrieval functions, object return functions, object generation functions, and dormant object generation functions for different object types.

[0068] The object creation function for each object type is used to initially create a dormant object of that object type; the object retrieval function is used to retrieve a dormant object from the first object pool, or, to retrieve a usable object from the second object pool; the usable object generation function is used to generate a usable object from the retrieved dormant object; the dormant object generation function is used to generate a dormant object from the retrieved usable object; and the object return function is used to store the generated dormant object in the first object pool.

[0069] In some implementations, when generating a user object from a dormant object, the object factory module 202 replaces the initial general data of the dormant object with the business data corresponding to the creation operation, and associates the unique identifier of the creation operation with the dormant object to generate the user object.

[0070] For details on generating a user object based on a dormant object, please refer to the description of step S12a.

[0071] In some implementations, when generating a dormant object based on a user object, the object factory module 202 removes the association between the user object and the unique identifier of the creation operation, and replaces the business data corresponding to the creation operation in the user object with the initial general data to obtain the dormant object.

[0072] For details on generating a hibernation object based on the object being used, please refer to the description of step S31.

[0073] One embodiment of this application provides an object processing apparatus 300. Please refer to [link to relevant documentation]. Figure 4 As shown, the object processing device 300 includes: a determining module 31, a creating module 32, and a memory monitoring module 33; wherein, the determining module 31 is used to determine whether a dormant object exists in a first object pool in response to a creation operation of creating a target user object, wherein the first object pool is used to store at least one dormant object with the same object type as the target user object to be created; the creating module 32 is used to, if yes, when the detected memory pressure value is less than a first preset threshold, retrieve the dormant object from the first object pool, generate the target user object based on the dormant object, and store the target user object in a second object pool, wherein the second object pool is used to store at least one user object with the same object type as the target user object; the memory monitoring module 33 is used to, when the detected memory pressure value is greater than or equal to the first preset threshold, clear the dormant object in the first object pool to reclaim memory.

[0074] In one implementation, the creation module 32 is further configured to replace the initial general data of the dormant object with the business data corresponding to the creation operation, and associate the unique identifier of the creation operation with the dormant object to generate the target user object.

[0075] In one implementation, the creation module 32 is also configured to, in response to the recycling operation of returning the target object, obtain the target object from the second object pool; when the memory pressure value is detected to be less than a first preset threshold, reset the target object to obtain a dormant object, and store the dormant object in the first object pool.

[0076] As one implementation, the memory monitoring module 33 is also used to delete the acquired target object and clear the dormant object in the first object pool to reclaim memory when the detected memory pressure value is greater than or equal to a first preset threshold.

[0077] In one implementation, the creation module 32 is also used to remove the association between the target user object and the unique identifier of the creation operation, and replace the business data corresponding to the creation operation in the target user object with initial general data to obtain the dormant object.

[0078] In one implementation, the memory monitoring module 33 is also used to obtain the current available memory amount or the current used memory amount, and to obtain the memory pressure value based on the current available memory amount or the current used memory amount.

[0079] As one implementation, the memory monitoring module 33 is also used to determine the memory pressure value based on the ratio of the currently used memory amount to the total memory amount.

[0080] In one implementation, the creation module 32 is further configured to, when receiving an initialization creation instruction for creating a hibernation object, create an initial hibernation object according to the object type, create the first object pool according to the object type, write the initial general data of the corresponding object type into the initial hibernation object to obtain the hibernation object, and store the hibernation object in the first object pool.

[0081] In one implementation, the creation module 32 is further configured to, if so, create the dormant object according to the object type of the target user object, generate the target user object according to the dormant object, and store the target user object in the second object pool.

[0082] The device in this embodiment uses a first object pool and a second object pool. The first object pool is used to temporarily store reusable dormant objects, and the second object pool is used to store objects in use, eliminating the need for frequent creation and destruction of objects in use. Furthermore, when the detected memory pressure value is greater than or equal to a first preset threshold, the first object pool is cleared. By setting memory pressure sensing and release capabilities, it is possible to proactively and intelligently release resources to ensure memory safety when memory is tight, and flexibly expand the second object pool to improve the reuse rate when memory is sufficient, which is beneficial to improving memory efficiency and application performance.

[0083] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device 60 includes a processor 61 and a memory 62 coupled to the processor 61.

[0084] The memory 62 stores program instructions for implementing the singing voice conversion method or the timbre conversion model training method of any of the above embodiments.

[0085] The processor 61 is used to execute program instructions stored in the memory 62 to process objects.

[0086] The processor 61 can also be referred to as a CPU (Central Processing Unit). The processor 61 may be an integrated circuit chip with signal processing capabilities. The processor 61 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.

[0087] Exemplary examples show that the electronic devices in this embodiment may include, but are not limited to, weight scales, body fat scales, nutrition scales, infrared electronic thermometers, pulse oximeters, body composition analyzers, power banks, wireless chargers, fast chargers, car chargers, adapters, displays, USB (Universal Serial Bus) docking stations, styluses, true wireless earbuds, car infotainment screens, automobiles, smart wearable devices, mobile terminals, and smart home devices. Smart wearable devices include, but are not limited to, smartwatches, smart bracelets, and neck massagers. Mobile terminals include, but are not limited to, smartphones, laptops, tablets, and POS (point of sales terminal) machines. Smart home devices include, but are not limited to, smart sockets, smart rice cookers, smart robot vacuums, and smart lights.

[0088] See Figure 6 , Figure 6This is a schematic diagram of the structure of a computer-readable storage medium according to an embodiment of this application. The storage medium 70 of this embodiment stores program instructions 71 capable of implementing all the methods described above. These program instructions 71 can be stored in the storage medium in the form of a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, or terminal devices such as computers, servers, mobile phones, and tablets.

[0089] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0090] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units described above can be implemented in hardware or as software functional units. The above are merely embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made based on the description and drawings of this application, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

[0091] The above description is merely an embodiment of this application. It should be noted that those skilled in the art can make improvements without departing from the inventive concept of this application, but these improvements all fall within the protection scope of this application.

Claims

1. A method for processing objects, characterized in that, include: In response to the creation operation of the target object, it is determined whether there is a dormant object in the first object pool, wherein the first object pool is used to store at least one dormant object with the same object type as the target object to be created; If so, when the detected memory pressure value is less than the first preset threshold, the hibernation object is obtained from the first object pool, the target usage object is generated based on the hibernation object, and the target usage object is stored in the second object pool, wherein the second object pool is used to store at least one usage object with the same object type as the target usage object; When the detected memory pressure value is greater than or equal to the first preset threshold, the dormant objects in the first object pool are cleared to reclaim memory.

2. The object processing method according to claim 1, characterized in that, The step of generating the target user object based on the dormant object includes: The initial general data of the dormant object is replaced with the business data corresponding to the creation operation, and the unique identifier of the creation operation is associated with the dormant object to generate the target user object.

3. The object processing method according to claim 1, characterized in that, The object processing method also includes: In response to the recycling operation that returns the target object, the target object is retrieved from the second object pool; When the detected memory pressure value is less than the first preset threshold, the target object is reset to obtain a hibernation object, and the hibernation object is stored in the first object pool.

4. The object processing method according to claim 3, characterized in that, After retrieving the target object from the second object pool in response to the recycling operation of returning the target object, the method further includes: When the detected memory pressure value is greater than or equal to the first preset threshold, the acquired target object is deleted, and the dormant object in the first object pool is cleared to reclaim memory.

5. The object processing method according to claim 3, characterized in that, The step of resetting the target object to obtain a dormant object includes: The association between the target user object and the unique identifier of the creation operation is removed, and the business data corresponding to the creation operation in the target user object is replaced with the initial general data to obtain the dormant object.

6. The object processing method according to claim 1, characterized in that, The object processing method also includes: Obtain the current available memory amount or the current used memory amount, and obtain the memory pressure value based on the current available memory amount or the current used memory amount.

7. The object processing method according to claim 6, characterized in that, The memory pressure value is obtained based on the currently used memory amount, including: The memory pressure value is determined based on the ratio of the currently used memory to the total memory.

8. The object processing method according to claim 1, characterized in that, The object processing method also includes: When an initialization creation instruction for creating a hibernation object is received, an initial hibernation object is created according to the object type, and the first object pool is created according to the object type. The initial general data of the corresponding object type is written into the initial dormant object to obtain the dormant object, and the dormant object is stored in the first object pool.

9. The object processing method according to claim 1, characterized in that, The object processing method also includes: If so, the dormant object is created according to the object type of the target user object, the target user object is generated according to the dormant object, and the target user object is stored in the second object pool.

10. An object processing apparatus, characterized in that, include: The determination module is used to determine whether a dormant object exists in a first object pool in response to a creation operation that creates a target object; wherein the first object pool is used to store at least one dormant object with the same object type as the target object to be created. A creation module is configured to, if the detected memory pressure value is less than a first preset threshold, retrieve the hibernation object from the first object pool, generate the target usage object based on the hibernation object, and store the target usage object in a second object pool, wherein the second object pool is used to store at least one usage object of the same object type as the target usage object; The memory monitoring module is used to clear the hibernating objects in the first object pool to reclaim memory when the detected memory pressure value is greater than or equal to a first preset threshold.

11. An object processing system, characterized in that, include: The memory monitoring module is used to obtain the current available memory or the current used memory, and to obtain the memory pressure value based on the current available memory or the current used memory. The object factory module is used to create dormant objects; Generate a user object from a dormant object; and generate a dormant object from a user object.

12. An electronic device, characterized in that, The device includes a processor and a memory connected to the processor, the memory storing program instructions executable by the processor; when the processor executes the program instructions stored in the memory, it implements a method for processing the object as described in any one of claims 1 to 9.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions that, when executed by a processor, implement the method for processing the object as described in any one of claims 1 to 9.