Memory management method and device, electronic equipment and storage medium
By creating target underlying objects and script-layer objects in software programs and setting them to hold each other, the problem of unreasonable memory recycling timing in the existing technology is solved, and the stability of the software program is improved.
Patent Information
- Application Number
- CN202311181926.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-03-14
AI Technical Summary
In the prior art, the resource memory recovery timing in the underlying and logical layers of the software program is unreasonable, which affects the operating performance and stability of the software program.
By creating target underlying objects and script-layer objects and setting them to hold each other, these objects are simultaneously recycled from memory after the target condition is met.
It avoids memory errors or problems that affect the program's running performance caused by the script layer object or the underlying object being recycled in advance, and improves the stability of the software program.
Smart Images

Figure CN119621293A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular to a memory management method, device, electronic device, and storage medium. Background Art
[0002] Currently, in the development stage of software programs, in order to improve the running efficiency of software programs, software program developers usually divide the software programs into two parts: the bottom layer and the logic layer, and design them separately. The bottom layer is usually implemented based on a compiled language to improve code efficiency, while the logic layer is usually implemented based on a scripting language to ensure the flexibility and iteration speed of the logic design in the software program.
[0003] In the prior art, during the operation of a software program designed based on the above-mentioned architecture, it is necessary to manage the memory resources occupied by the bottom layer and the logical layer in the software program through the memory management unit of the operating system. However, the solution in the prior art has the problem of unreasonable timing for memory recycling for resources in the bottom layer and the logical layer, which affects the running performance and stability of the software program. Summary of the invention
[0004] The embodiments of the present disclosure provide a memory management method, device, electronic device and storage medium to overcome the problem of unreasonable timing of memory recycling for resources in the bottom layer and the logical layer.
[0005] In a first aspect, an embodiment of the present disclosure provides a memory management method, including:
[0006] A target underlying object is created, wherein the underlying object is a data object implemented based on a compiled language; in response to a first script instruction, a first script layer object is obtained, and the target underlying object and the first script layer object are set to be in a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory; after the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory.
[0007] In a second aspect, an embodiment of the present disclosure provides a memory management device, including:
[0008] A creation module, used to create a target underlying object, wherein the target underlying object is a data object implemented based on a compiled language;
[0009] A processing module, configured to create a script layer object in response to a first script instruction, and set the target underlying object and the first script layer object to be in a mutually held state, wherein the first script layer object is a data object implemented based on a scripting language, the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory;
[0010] A recycling module is used to synchronously recycle the target underlying object and the first script layer object from the memory after the target condition is met.
[0011] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0012] The memory stores computer-executable instructions;
[0013] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the memory management method as described in the first aspect and various possible designs of the first aspect.
[0014] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the memory management method described in the first aspect and various possible designs of the first aspect is implemented.
[0015] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the memory management method described in the first aspect and various possible designs of the first aspect.
[0016] The memory management method, device, electronic device and storage medium provided in this embodiment create a target underlying object, wherein the underlying object is a data object implemented based on a compiled language; in response to a first script instruction, obtain a first script layer object, and set the target underlying object and the first script layer object to a mutually held state, wherein the script layer object is a data object implemented based on a script language, the first script layer object is used to reference the target underlying object to implement a first target operation for the target underlying object, and the data object in the held state is continuously maintained in the memory; after the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory. After the first script layer object is created, the first script layer object and the target underlying object are set to a mutually held state, so that the first script layer object and the target underlying object can be maintained in the memory at the same time, and are recovered at the same time after the target condition is met, thereby avoiding the problem of memory error or affecting the program running performance caused by the early recovery of the first script layer object or the target underlying object, thereby improving the stability of the software program. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 A schematic diagram of the functional architecture of an application provided in an embodiment of the present disclosure;
[0019] Figure 2 Schematic diagram of the memory management method provided in the embodiment of the present disclosure Figure 1 ;
[0020] Figure 3 This is a flowchart of a specific implementation method of step S100 in the embodiment of the present disclosure;
[0021] Figure 4 A schematic diagram of a first script layer object and a target bottom layer object in a mutually holding state provided by an embodiment of the present disclosure;
[0022] Figure 5 for Figure 2 A flowchart of a specific implementation method of step S102 in the illustrated embodiment;
[0023] Figure 6 Schematic diagram of the memory management method provided in the embodiment of the present disclosure Figure 2 ;
[0024] Figure 7 for Figure 6 A flowchart of a specific implementation method of step S201 in the illustrated embodiment;
[0025] Figure 8 for Figure 6 A flowchart of a specific implementation method of step S203 in the illustrated embodiment;
[0026] Fig. 9 for Figure 6 A flowchart of a specific implementation method of step S204 in the illustrated embodiment;
[0027] Fig.10 A schematic diagram of synchronously recovering a first script layer object and a target underlying object provided by an embodiment of the present disclosure;
[0028] Fig.11 A structural block diagram of a memory management device provided in an embodiment of the present disclosure;
[0029] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;
[0030] Fig.13 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0032] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] The application scenarios of the embodiments of the present disclosure are explained below:
[0034] The memory management method provided by the embodiment of the present disclosure can be applied to applications developed based on scripting languages, and more specifically, can be applied to the running process of applications. The execution subject of this embodiment can be a terminal device running the above-mentioned application developed based on scripting languages, or a server running the server corresponding to the above-mentioned application, or other electronic devices with similar functions. Figure 1 A schematic diagram of the functional architecture of an application provided in an embodiment of the present disclosure, referring to Figure 1 As shown in , the application running in the terminal device is composed of upper-layer functions and lower-layer functions, and the upload function is realized by calling the lower-layer functions. Among them, taking game applications as an example, the upper-layer functions are, for example, display control, interactive logic, etc. in the game. The upper-layer functions support development with scripting languages, such as JS language, Python language, etc., so the upper-layer functions are also called scripting layer functions. Developing scripting layer functions with scripting languages can improve the flexibility of the application and the speed of program iteration. The lower-layer functions are, for example, lower-layer functional modules or functional engines that support the operation of games, such as image rendering, texture generation, light calculation, etc. Such lower-layer functions are usually developed in compiled languages, such as C language and C++ language, so that the lower-layer functions have the performance of realization. Among them, each function is realized by an object created by the application. Specifically, the upper-layer function is realized by the scripting layer object created in the scripting layer, and the lower-layer function is realized by the lower-layer object created in the lower layer. The scripting layer object needs to reference the lower-layer object to realize the corresponding lower-layer function.
[0035] In the prior art, during the operation of a software program designed based on the above-mentioned architecture, it is necessary to manage the memory resources occupied by the bottom layer and the logical layer in the software program through the memory management unit of the operating system. However, the solution in the prior art has the problem of unreasonable timing for memory recycling for resources in the bottom layer and the logical layer, which affects the running performance and stability of the software program.
[0036] The embodiments of the present disclosure provide a memory management method to solve the above problems.
[0037] refer to Figure 2 , Figure 2 Schematic diagram of the memory management method provided in the embodiment of the present disclosure Figure 1 The method of this embodiment can be exemplarily applied in a terminal device, and the memory management method includes:
[0038] Step S101: Create a target underlying object, wherein the underlying object is a data object implemented based on a compiled language.
[0039] For example, refer to Figure 1The functional architecture diagram shown in the figure shows that after the terminal device runs the target application, the underlying functional modules will be initialized first. Taking the game application as an example, the game engine will be initialized. After that, based on different trigger conditions, data objects implemented based on the compiled language and running at the bottom of the program, i.e., underlying objects, are created. The compiled language is, for example, C language, C++ language, etc. The data object implemented by the compiled language is the object generated after the class written by the compiled language is instantiated in the memory. Among them, the class is a general term for describing certain objects, and the object is an instance of this class. The common attributes and behaviors (functions or methods) possessed by objects belonging to the same class are defined in the class. In the running application, the specific implementation method of creating objects through classes is a prior art known to those skilled in the art and will not be repeated here.
[0040] Furthermore, the target underlying object can be an underlying object created based on specific instructions. In one possible implementation, the target underlying object can be created by other underlying objects running in the memory. For example, in a game engine, a texture object for loading textures is created by the MeshRender component, wherein the texture object is the target underlying object created, and the MeshRender component runs on other underlying objects in the memory. Afterwards, the MeshRender component implements functions such as texture rendering by creating the created texture object. In another possible implementation, the target underlying object can be created by a script layer object running in the memory, and the specific implementation is similar, and the steps are repeated. The specific implementation method of creating the target underlying object can be implemented by calling the creation method of the corresponding target class, and the specific implementation method is not repeated.
[0041] Step S102: In response to the first script instruction, the first script layer object is obtained, and the target underlying object and the first script layer object are set to be in a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory.
[0042] Exemplarily, the first script instruction is used to indicate a specific operation purpose and implement a specific operation function, such as setting the transparency of the texture in the image to 50%. According to the first script instruction, the terminal device creates or uses the corresponding first script layer object, and references the target underlying object through the first script layer object to perform the corresponding first target operation to implement the above-mentioned target function. Among them, the first script instruction can be a code instruction triggered by the code logic of the preset script layer program, such as automatically triggered after reaching a preset condition (such as a preset time, the attribute value of a data object reaches a preset value, etc.), or it can be a code instruction generated by an interactive interface implemented based on the script layer program in response to the user's operation on the terminal device, which is not limited here.
[0043] Furthermore, after the first script layer object is acquired in response to the first script instruction, under normal conditions, since the first script layer object references (strongly references) the target underlying object, the target underlying object is in a held state. At this time, the garbage collector (garbage collection system) of the operating system will not recycle the target underlying object, so that it is always maintained in the memory. However, when the first script layer object is not held by other objects, it will cause the first script layer object to be recycled by the garbage collector, and the script logic will no longer be executed. Afterwards, if other logics of the script layer need to use the target underlying object again, since the first script layer object has been recycled, it is necessary to recreate a script layer object to implement the function of the first script layer object, which leads to repeated, frequent creation and recycling of script layer objects, resulting in program performance being affected.
[0044] In this embodiment, after the first script layer object and the target underlying object are created, the first script layer object and the target underlying object are set to a mutually held state, that is, the first script layer object holds the target underlying object, and the target underlying object holds the first script layer object; that is, the target underlying object is held by the first script layer object, and the first script layer object is held by the target underlying object. When the first script layer object and the target underlying object are set to a mutually held state, since both the first script layer object and the target underlying object are in a held state, the garbage collector of the operating system will not recycle the first script layer object and the target underlying object, so that the first script layer object and the target underlying object are always maintained in the memory. This avoids the above-mentioned problem.
[0045] Optionally, after step S102, the method further includes:
[0046] Step S100: When the second script instruction is received, the first script layer object continuously maintained in the memory is called to respond to the second script instruction to obtain an instruction result corresponding to the second script instruction.
[0047] Exemplarily, the second script instruction is a script instruction obtained by the terminal device (application) after the first script instruction, and is used to reference the target underlying object to implement a second target operation on the target underlying object. After receiving the second script instruction, the terminal device responds to the second script instruction. Since the first script layer object is maintained in the memory, the second target operation represented by the second script instruction can be responded to by calling the first script layer object, thereby obtaining a corresponding instruction result.
[0048] Furthermore, if Figure 3 As shown, the specific implementation of step S100 includes:
[0049] Step S100A: Obtain the target underlying object that is continuously maintained in the memory by calling the first script layer object that is continuously maintained in the memory.
[0050] Step S100B: Based on the second script instruction, a second target operation is performed on the target underlying object continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction.
[0051] Figure 4 A schematic diagram of a first script layer object and a target bottom layer object in a mutually holding state provided by an embodiment of the present disclosure, such as Figure 4 As shown, after the first script layer object and the target underlying object are created, the first script layer object (shown as Script_1 in the figure) can respond to the first target operation indicated by the first script instruction by referencing the target underlying object (shown as Object_1 in the figure), for example, "set the image texture color to red". Thus, the first instruction result corresponding to the first script instruction is obtained and output; afterwards, since the first script layer object and the target underlying object are in a mutually held state, the first script layer object and the target underlying object are continuously maintained in the memory for a certain period of time (target condition). When the application obtains the second script instruction again, the second script instruction can continue to use the first script layer object to respond to the second target operation indicated by the second script instruction, for example, "set the image texture color to white", thereby obtaining and outputting the second instruction result corresponding to the second script instruction.
[0052] In the steps of this embodiment, the target underlying object and the first script layer object are set to be in a mutually held state, so that the target underlying object and the first script layer object are maintained in the content at the same time. Therefore, when responding to different script instructions in multiple stages, the response can be made by always maintaining the first script layer object in the memory, avoiding the resource overhead caused by frequent recovery and creation of script layer objects, thereby improving program performance and stability.
[0053] Furthermore, in a possible implementation, Figure 5 As shown, in step S102, the target bottom layer object and the first script layer object are set to be in a mutually owned state, including:
[0054] Step S1021: After creating the first script layer object, the first script layer object is set to hold the target underlying object.
[0055] Step S1022: Obtain the referenced status of the target underlying object.
[0056] Step S1023: When it is detected that the target underlying object is referenced by the first script layer object, the target underlying object is set to hold the first script layer object.
[0057] Exemplarily, after creating the first script layer object for quoting the target underlying object, the first script layer object is set to hold the target underlying object. Specifically, exemplarily, the first script layer object has a script layer object attribute, and the script layer object attribute is used to record the underlying object held by the first script layer object. By setting the script layer object attribute of the first script layer object, the first script layer object is set to hold the target underlying object. Afterwards, the referenced state of the target underlying object is obtained. In a possible implementation, it can be determined whether the target underlying object is referenced by other variables or objects through the pointer of the target underlying object by other variables or objects, that is, the referenced state. Further, the target underlying object has a corresponding underlying object attribute. Exemplarily, the target underlying object records which data object is held by the underlying object attribute. According to the referenced state of the target underlying object obtained in the above steps, when the target underlying object is in a state of being quoted by the first script layer object, the target underlying object is set to hold the first script layer object by setting the underlying object attribute of the target underlying object.
[0058] Step S103: after the target condition is met, the target bottom layer object and the first script layer object are synchronously recovered from the memory.
[0059] Exemplarily, further, after the target underlying object and the first script layer object are set to a mutually holding state, the target underlying object and the first script layer object will continue to be maintained in the memory. In order to improve the resource utilization of the memory, after the target condition is met, the target underlying object and the first script layer object are synchronously recycled, that is, the resources are released, so as to avoid the reference error problem caused by the single object recycling of the data object in the prior art. Specifically, when only the target underlying object is recycled and the script layer object is not recycled, here, when other script instructions call the first script layer object, since the target underlying object referenced by the first script layer object has been recycled, a reference exception error will occur.
[0060] In the present application, after reaching the target condition, the target underlying object and the first script layer object are synchronously recycled. When the terminal device obtains the script instruction again, the script layer object and the corresponding underlying object are recreated to respond to the new script instruction, thereby avoiding the error of reference exception. Among them, the specific implementation method of synchronously recycling the target underlying object and the script layer object can be achieved by releasing the mutual holding state between the target underlying object and the script layer object. After releasing the mutual holding state between the target underlying object and the script layer object, the garbage collector of the operating system will recycle the data objects that are not held. After that, after the data object that is not held is recycled, its holding state for another data object is also released, and the garbage collector then recycles the other data object.
[0061] In the disclosed embodiment, by creating a target underlying object, wherein the underlying object is a data object implemented based on a compiled language; in response to a first script instruction, obtaining a first script layer object, and setting the target underlying object and the first script layer object to a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation for the target underlying object, and the data object in a held state is continuously maintained in the memory; after the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory. By setting the first script layer object and the target underlying object to a mutually held state after the first script layer object is created, the first script layer object and the target underlying object can be maintained in the memory at the same time, and recovered at the same time after the target condition is met, thereby avoiding the problem of memory error or affecting the program running performance caused by the early recovery of the first script layer object or the target underlying object, and improving the stability of the software program.
[0062] refer to Figure 6 , Figure 6 Schematic diagram of the memory management method provided in the embodiment of the present disclosure Figure 2 In this embodiment Figure 2 On the basis of the illustrated embodiment, step S103, i.e., the step of releasing resources, is further refined. The memory management method includes:
[0063] Step S201: Create a target underlying object, wherein the underlying object is a data object implemented based on a compiled language.
[0064] For example, Figure 7 As shown, the specific implementation of step S201 includes:
[0065] Step S2011: Based on the third script instruction, generate other underlying objects or third script layer objects.
[0066] Step S2012: Create a target underlying object referenced by other underlying objects or the third script layer object through other underlying objects or the third script layer object.
[0067] Exemplarily, the target underlying object can be created based on the third script instruction. In a possible implementation method, the third script instruction can be an initialization instruction after the application is run, which is generated by executing the script code in the application. Afterwards, the corresponding underlying object or script layer object, that is, other underlying objects or third script layer objects, is created in the memory of the terminal device. Afterwards, the corresponding target underlying object is created by other underlying objects or third script layer objects. The implementation method of creating the target underlying object can be implemented by operating other underlying objects or third script layer objects to call the object creation method of the underlying class, and the specific method will not be repeated. The target underlying object created by other underlying objects or third script layer objects is implemented based on a compiled language and is referenced by other underlying objects or third script layer objects. In subsequent steps, by operating other underlying objects or third script layer objects, the operation of the target underlying object can be realized, thereby realizing the corresponding target function.
[0068] Step S202: In response to the first script instruction, the first script layer object is obtained, and the target underlying object and the first script layer object are set to be in a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory.
[0069] Step S203: Detect the holding status of the target underlying object by other underlying objects.
[0070] Exemplarily, the target underlying object is also held by at least one other underlying object, and the other underlying object is used to reference the target underlying object to implement the third target operation on the target underlying object; wherein the target condition includes: the other underlying object releases the holding of the target underlying object. Further, wherein the other underlying object refers to a data object that is also located at the bottom layer and implemented by a compiled language. The holding state refers to whether the target underlying object is held by other data objects and can be continuously maintained in the memory. The holding state can be represented by a state identifier, for example, state identifier 0, indicating that the target underlying object is held by other underlying objects, and state identifier 1, indicating that the target underlying object is not held by other underlying objects. With the case type of the script layer object holding the target underlying object, when other underlying objects hold the target underlying object, the target underlying object can also be continuously maintained in the memory without being recycled. Correspondingly, when the target underlying object is not held by other underlying objects, it can be used as a target condition for releasing the mutual holding of the target underlying object and the first script layer object to trigger the synchronous recycling of the target underlying object and the first script layer object. Among them, the state identifier can be a parameter value corresponding to the target underlying object, which is preset in the terminal device and can be set based on user instructions, thereby realizing manual configuration of the mutual holding state of the target underlying object and the first script layer object.
[0071] In another possible implementation, Figure 8 As shown, the specific implementation of step S203 includes:
[0072] Step S2031: Obtain a first attribute of the target underlying object, where the first attribute represents the number of times the target underlying object is referenced by the shared pointer.
[0073] Step S2032: According to the first attribute, obtain the holding status of the target underlying object by other underlying objects.
[0074] Exemplarily, the target underlying object has a first attribute, and the terminal device can obtain the first data of the target underlying object by obtaining the object method provided by the target underlying object. The first attribute represents the number of times the target underlying object is referenced by a shared pointer (ShardPtr). A shared pointer is a smart pointer, and several shared pointers can point to the same data object, thereby realizing the association and reference to the data object. On the one hand, when the owner of the shared pointer (other underlying objects) exists, its corresponding associated object or associated resource (i.e., the target underlying object) will be in a held state and maintained in memory; and when the owner of the last shared pointer is destroyed (reclaimed), the associated object or associated resource will be deleted.
[0075] Furthermore, by obtaining the first attribute of the target underlying object, the number of other underlying objects currently associated with and referencing (i.e., holding) the target underlying object is determined. When the number is 0, it means that all owners of the shared pointer have been destroyed, i.e., no other underlying object holds the target underlying object. At this time, the target underlying object is in an unheld state. On the contrary, when the number is not 0, it means that not all owners of the shared pointer have been destroyed. At this time, at least one other underlying object holds the target underlying object. Therefore, the target underlying object is in a held state. Furthermore, the timing of releasing the mutual holding state between the target underlying object and the first script layer object can be determined based on the holding state.
[0076] Step S204: when the target underlying object is not held by other underlying objects, the bidirectional holding state between the target underlying object and the first script layer object is released, and the target underlying object and the first script layer object are synchronously recovered.
[0077] Exemplarily, when the target underlying object is in a state where it is not held by other underlying objects, the release of the bidirectional holding state of the target underlying object and the first script layer object is triggered. Specifically, the release order of the holding state of the target underlying object and the first script layer object can be set as needed. That is, the holding of the first script layer object by the target underlying object is first released, and then the holding of the target underlying object by the first script layer object is released. Alternatively, the holding of the target underlying object by the first script layer object is first released, and then the holding of the target underlying object by the first script layer object is released. In a possible implementation, as Fig. 9 As shown, the specific implementation of step S204 includes:
[0078] Step S2041: Release the target bottom layer object's holding on the first script layer object.
[0079] Step S2042: Recycle the first script layer object.
[0080] Step S2043: Release the first script layer object's holding on the target underlying object.
[0081] Step S2044: Recycle the target underlying object.
[0082] Exemplarily, based on the introduction in the previous embodiment steps, when the target underlying object is in a state where it is not held by other underlying objects, the target underlying object can first release its holding of the first script layer object, at which point the first script layer object is in a recyclable state; then the garbage collector recycles the first script layer object. Furthermore, after the first script layer object is recycled, the target underlying object loses the holding of the first script layer object, and is therefore also in a recyclable state, and then the target underlying object is recycled, completing the synchronous recycling process of the first script layer object and the target underlying object. In another possible implementation, the mutual holding state of the first script layer object and the target underlying object can also be released by setting the object properties of the first script layer object and the target underlying object, and then the first script layer object and the target underlying object are recycled at the same time.
[0083] Fig.10 A schematic diagram of synchronously recovering a first script layer object and a target underlying object provided by an embodiment of the present disclosure, such as Fig.10 As shown, when the application in the terminal device runs to the first state, the first script layer object (shown as Script_1 in the figure) and the target underlying object (shown as Object_1 in the figure) hold each other, and at the same time, other underlying objects (shown as ShardPtr in the figure) hold the target underlying object. When other underlying objects are recycled, other underlying objects no longer hold the target underlying object. Here, the target underlying object releases its hold on the first script layer object, which is the second state shown in the figure. Further, the first script layer object releases its hold on the target underlying object, so that the first script layer object and the target underlying object are both in a state that can be recycled, or the first script layer object is first deleted, so that the target underlying object is both in a state that can be recycled, and finally the first script layer object and the target underlying object are synchronously recycled, that is, the recycling is completed.
[0084] Furthermore, with respect to step S2044, in the process of recycling the target underlying object, in order to further improve the stability of the application program operation, the embodiment of the present disclosure provides an implementation method, and the specific implementation manner of step S2044 includes:
[0085] Step S2044A: Acquire a second attribute of the target underlying object, where the second attribute represents the number of times the target underlying object is held by at least one script layer object.
[0086] Step S2044B: According to the second attribute, if the target underlying object is not referenced by any script layer object, the target underlying object is recycled.
[0087] Exemplarily, it is similar to the first property of the target underlying object. The target underlying object also has a second property, which can be obtained by calling the object method corresponding to the target underlying object, and the second property characterizes the number of times the target underlying object is held by at least one script layer object. Afterwards, according to the second property, if the target underlying object is not referenced by any script layer object, it means that no other script layer object in the current memory references it, and in this case, the target underlying object can be recycled. On the contrary, if according to the second property, the target underlying object is held by at least one script layer object, the target underlying object is not recycled, but continues to be maintained in the memory, thereby avoiding the reference exception problem caused by other script layer objects being unable to reference the target underlying object, and improving the running stability of the application.
[0088] It is understandable that in another possible implementation, the first script layer object may first release the holding of the target underlying object, and then release the holding of the first script layer object by the target underlying object, and then recycle the first script layer object. The specific implementation is the same as Fig. 9 The implementation methods of each step in the illustrated embodiment are similar and will not be repeated here.
[0089] In this embodiment, the implementation method of step S202 is the same as that of the present disclosure. Figure 2 The implementation method of step S102 in the illustrated embodiment is the same and will not be described in detail here.
[0090] Corresponding to the memory management method of the above embodiment, Fig.11 This is a structural block diagram of a memory management device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown.
[0091] Reference Fig.11 , the memory management device 3 comprises:
[0092] A creation module 31 is used to create a target underlying object, where the target underlying object is a data object implemented based on a compiled language;
[0093] The processing module 32 is used to create a script layer object in response to the first script instruction, and set the target underlying object and the first script layer object to be in a mutually held state, wherein the first script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory;
[0094] The recycling module 33 is used to synchronously recycle the target bottom layer object and the first script layer object from the memory after the target condition is met.
[0095] In one embodiment of the present disclosure, the recycling module 33 is specifically used to: detect the holding status of other underlying objects on the target underlying object; when the target underlying object is not held by other underlying objects, release the bidirectional holding status of the target underlying object and the first script layer object; synchronously recycle the target underlying object and the first script layer object.
[0096] In one embodiment of the present disclosure, when releasing the bidirectional holding state between the target underlying object and the first script layer object, the recycling module 33 is specifically used to: release the holding of the target underlying object to the first script layer object, then recycle the first script layer object, and release the holding of the first script layer object to the target underlying object; or, release the holding of the first script layer object to the target underlying object, then recycle the target underlying object, and release the holding of the target underlying object to the first script layer object.
[0097] In one embodiment of the present disclosure, when detecting the holding status of other underlying objects on the target underlying object, the recycling module 33 is specifically used to: obtain a first attribute of the target underlying object, where the first attribute represents the number of times the target underlying object is referenced by a shared pointer; and obtain the holding status of other underlying objects on the target underlying object based on the first attribute.
[0098] In one embodiment of the present disclosure, when recycling the target underlying object, the recycling module 33 is specifically used to: obtain a second attribute of the target underlying object, where the second attribute represents the number of times the target underlying object is held by at least one script layer object; and based on the second attribute, if the target underlying object is not referenced by any script layer object, recycle the target underlying object.
[0099] In one embodiment of the present disclosure, when the processing module 31 sets the target underlying object and the first script layer object to a mutually holding state, it is specifically used to: after creating the first script layer object, set the first script layer object to hold the target underlying object; obtain the referenced state of the target underlying object; when it is detected that the target underlying object is referenced by the first script layer object, set the target underlying object to hold the first script layer object.
[0100] In one embodiment of the present disclosure, the target underlying object is also held by at least one other underlying object, and the other underlying object is used to reference the target underlying object to implement a second target operation on the target underlying object; wherein the target condition includes: the other underlying object releases its holding on the target underlying object.
[0101] In one embodiment of the present disclosure, the processing module 32 is further used to: when receiving the second script instruction, respond to the second script instruction by calling the first script layer object continuously maintained in the memory to obtain the instruction result corresponding to the second script instruction.
[0102] In one embodiment of the present disclosure, when the processing module 32 responds to the second script instruction by calling the first script layer object that is continuously maintained in the memory and obtains the instruction result corresponding to the second script instruction, it is specifically used to: obtain the target underlying object that is continuously maintained in the memory by calling the first script layer object that is continuously maintained in the memory; based on the second script instruction, perform a second target operation on the target underlying object that is continuously maintained in the memory to obtain the instruction result corresponding to the second script instruction.
[0103] In one embodiment of the present disclosure, the creation module 31 is specifically used to: generate other underlying objects or third script layer objects based on the third script instruction; and create target underlying objects referenced by other underlying objects or third script layer objects through other underlying objects or third script layer objects.
[0104] The creation module 31, the processing module 32 and the recycling module 33 are connected in sequence. The memory management device 3 provided in this embodiment can implement the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be described in detail in this embodiment.
[0105] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown in FIG. Fig.12 As shown, the electronic device 4 includes:
[0106] A processor 41, and a memory 42 communicatively connected to the processor 41;
[0107] The memory 42 stores computer executable instructions;
[0108] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the following Figure 2-Figure 10 The memory management method in the illustrated embodiment.
[0109] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .
[0110] For related instructions, please refer to Figure 2-Figure 10 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further elaboration is made here.
[0111] The present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, which are used to implement the present invention when executed by a processor. Figure 2-Figure 10 The memory management method provided in any one of the corresponding embodiments.
[0112] In order to implement the above embodiment, the embodiment of the present disclosure also provides an electronic device.
[0113] refer to Fig.13 , which shows a schematic diagram of the structure of an electronic device 900 suitable for implementing the embodiment of the present disclosure, and the electronic device 900 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0114] like Fig.13 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0115] Typically, the following devices may be connected to the I / O interface 905: input devices 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 908 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.13 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0116] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0117] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0118] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0119] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0120] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0121] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0122] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0123] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0124] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. 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.
[0125] In a first aspect, according to one or more embodiments of the present disclosure, a memory management method is provided, comprising:
[0126] A target underlying object is created, wherein the underlying object is a data object implemented based on a compiled language; in response to a first script instruction, a first script layer object is obtained, and the target underlying object and the first script layer object are set to be in a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, and the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory; after the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory.
[0127] According to one or more embodiments of the present disclosure, after the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory, including: detecting the holding status of other underlying objects on the target underlying object; when the target underlying object is in a state where it is not held by the other underlying objects, releasing the bidirectional holding status of the target underlying object and the first script layer object; and synchronously recovering the target underlying object and the first script layer object.
[0128] According to one or more embodiments of the present disclosure, the releasing of the bidirectional holding state of the target underlying object and the first script layer object includes: releasing the holding of the first script layer object by the target underlying object, then recycling the first script layer object, and releasing the holding of the target underlying object by the first script layer object; or releasing the holding of the target underlying object by the first script layer object, then recycling the target underlying object, and releasing the holding of the target underlying object by the first script layer object.
[0129] According to one or more embodiments of the present disclosure, detecting the holding status of the target underlying object by other underlying objects includes: obtaining a first attribute of the target underlying object, the first attribute representing the number of times the target underlying object is referenced by a shared pointer; and obtaining the holding status of the target underlying object by other underlying objects based on the first attribute.
[0130] According to one or more embodiments of the present disclosure, the recycling of the target underlying object includes: obtaining a second attribute of the target underlying object, the second attribute representing the number of times the target underlying object is held by at least one script layer object; and recycling the target underlying object according to the second attribute if the target underlying object is not referenced by any script layer object.
[0131] According to one or more embodiments of the present disclosure, setting the target underlying object and the first script layer object to be in a mutually holding state includes: after creating the first script layer object, setting the first script layer object to hold the target underlying object; obtaining the referenced state of the target underlying object; and when detecting that the target underlying object is referenced by the first script layer object, setting the target underlying object to hold the first script layer object.
[0132] According to one or more embodiments of the present disclosure, the method further includes: when receiving a second script instruction, responding to the second script instruction by calling the first script layer object continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction.
[0133] According to one or more embodiments of the present disclosure, the method of responding to the second script instruction by calling the first script layer object continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction includes: obtaining the target underlying object continuously maintained in the memory by calling the first script layer object continuously maintained in the memory; and performing a second target operation on the target underlying object continuously maintained in the memory based on the second script instruction to obtain an instruction result corresponding to the second script instruction.
[0134] According to one or more embodiments of the present disclosure, the target underlying object is also held by at least one other underlying object, and the other underlying object is used to reference the target underlying object to implement a third target operation on the target underlying object; wherein the target condition includes: the other underlying object releases its holding on the target underlying object.
[0135] According to one or more embodiments of the present disclosure, the creation of the target underlying object includes: generating other underlying objects or a third script layer object based on a third script instruction; and creating a target underlying object referenced by the other underlying objects or the third script layer object through the other underlying objects or the third script layer object.
[0136] In a second aspect, according to one or more embodiments of the present disclosure, a memory management device is provided, including:
[0137] A creation module, used to create a target underlying object, wherein the target underlying object is a data object implemented based on a compiled language;
[0138] A processing module, configured to create a script layer object in response to a first script instruction, and set the target underlying object and the first script layer object to be in a mutually held state, wherein the first script layer object is a data object implemented based on a scripting language, the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory;
[0139] The recycling module is used to synchronously recycle the target underlying object and the first script layer object from the memory after the target condition is met.
[0140] According to one or more embodiments of the present disclosure, the recycling module is specifically used to: detect the holding status of other underlying objects on the target underlying object; when the target underlying object is in a state where it is not held by the other underlying objects, release the bidirectional holding status of the target underlying object and the first script layer object; and synchronously recycle the target underlying object and the first script layer object.
[0141] According to one or more embodiments of the present disclosure, when releasing the bidirectional holding state between the target underlying object and the first script layer object, the recycling module is specifically used to: release the holding of the first script layer object by the target underlying object, then recycle the first script layer object, and release the holding of the target underlying object by the first script layer object; or release the holding of the target underlying object by the first script layer object, then recycle the target underlying object, and release the holding of the target underlying object by the first script layer object.
[0142] According to one or more embodiments of the present disclosure, when detecting the holding status of other underlying objects on the target underlying object, the recycling module is specifically used to: obtain a first attribute of the target underlying object, the first attribute representing the number of times the target underlying object is referenced by a shared pointer; and obtain the holding status of other underlying objects on the target underlying object based on the first attribute.
[0143] According to one or more embodiments of the present disclosure, when the recycling module recycles the target underlying object, it is specifically used to: obtain a second attribute of the target underlying object, the second attribute representing the number of times the target underlying object is held by at least one script layer object; based on the second attribute, if the target underlying object is not referenced by any script layer object, recycle the target underlying object.
[0144] According to one or more embodiments of the present disclosure, when the processing module sets the target underlying object and the first script layer object to a mutually holding state, it is specifically used to: after creating the first script layer object, set the first script layer object to hold the target underlying object; obtain the referenced state of the target underlying object; and when it is detected that the target underlying object is referenced by the first script layer object, set the target underlying object to hold the first script layer object.
[0145] According to one or more embodiments of the present disclosure, the target underlying object is also held by at least one other underlying object, and the other underlying object is used to reference the target underlying object to implement a second target operation on the target underlying object; wherein the target condition includes: the other underlying object releases its holding on the target underlying object.
[0146] According to one or more embodiments of the present disclosure, the processing module is further used to: when receiving a second script instruction, respond to the second script instruction by calling the first script layer object continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction.
[0147] According to one or more embodiments of the present disclosure, when the processing module responds to the second script instruction by calling the first script layer object continuously maintained in the memory and obtains the instruction result corresponding to the second script instruction, it is specifically used to: obtain the target underlying object continuously maintained in the memory by calling the first script layer object continuously maintained in the memory; based on the second script instruction, perform a second target operation on the target underlying object continuously maintained in the memory to obtain the instruction result corresponding to the second script instruction.
[0148] According to one or more embodiments of the present disclosure, the creation module is specifically used to: generate other underlying objects or a third script layer object based on a third script instruction; and create a target underlying object referenced by the other underlying objects or the third script layer object through the other underlying objects or the third script layer object.
[0149] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0150] The memory stores computer-executable instructions;
[0151] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the memory management method as described in the first aspect and various possible designs of the first aspect.
[0152] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the memory management method described in the first aspect and various possible designs of the first aspect is implemented.
[0153] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the memory management method described in the first aspect and various possible designs of the first aspect.
[0154] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0155] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0156] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A memory management method, characterized in that: include: Creating a target underlying object, wherein the underlying object is a data object implemented based on a compiled language; In response to a first script instruction, a first script layer object is obtained, and the target underlying object and the first script layer object are set to be in a mutually held state, wherein the script layer object is a data object implemented based on a scripting language, the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory; After the target condition is met, the target underlying object and the first script layer object are synchronously recovered from the memory.
2. The method according to claim 1, characterized in that: After the target condition is met, synchronously recovering the target underlying object and the first script layer object from the memory includes: Detecting the holding status of the target underlying object by other underlying objects; When the target underlying object is in a state where it is not held by the other underlying objects, releasing the bidirectional holding state between the target underlying object and the first script layer object; The target underlying object and the first script layer object are synchronously recycled.
3. The method according to claim 2, characterized in that The releasing of the bidirectional holding state of the target underlying object and the first script layer object comprises: Release the target underlying object from holding the first script layer object, then recycle the first script layer object, and release the first script layer object from holding the target underlying object; Alternatively, the first script layer object releases its holding of the target underlying object, then recycles the target underlying object, and releases its holding of the first script layer object.
4. The method according to claim 2, characterized in that: The detecting the holding status of the target underlying object by other underlying objects includes: Acquire a first attribute of the target underlying object, where the first attribute represents the number of times the target underlying object is referenced by a shared pointer; According to the first attribute, the holding status of the target underlying object by other underlying objects is obtained.
5. The method according to claim 2, characterized in that: The recycling of the target underlying object comprises: Acquire a second attribute of the target underlying object, where the second attribute represents the number of times the target underlying object is held by at least one script layer object; According to the second attribute, if the target underlying object is not referenced by any script layer object, the target underlying object is recycled.
6. The method according to claim 1, characterized in that The step of setting the target underlying object and the first script layer object to be in a mutually owned state comprises: After creating the first script layer object, setting the first script layer object to hold the target underlying object; Get the referenced state of the target underlying object; When it is detected that the target underlying object is referenced by the first script layer object, the target underlying object is set to hold the first script layer object.
7. The method according to claim 1, characterized in that The method further comprises: When a second script instruction is received, the first script layer object continuously maintained in the memory is called to respond to the second script instruction and obtain an instruction result corresponding to the second script instruction.
8. The method according to claim 7, characterized in that The step of responding to the second script instruction by calling the first script layer object that is continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction includes: Obtain the target underlying object continuously maintained in the memory by calling the first script layer object continuously maintained in the memory; Based on the second script instruction, a second target operation is performed on the target underlying object that is continuously maintained in the memory to obtain an instruction result corresponding to the second script instruction.
9. The method according to claim 1, characterized in that: The target underlying object is also held by at least one other underlying object, and the other underlying object is used to reference the target underlying object to implement a third target operation on the target underlying object; wherein the target condition includes: The other underlying objects release their holdings on the target underlying object.
10. The method according to claim 1, characterized in that The step of creating a target underlying object includes: Based on the third script instruction, generate other bottom layer objects or third script layer objects; A target underlying object referenced by the other underlying object or the third scripting layer object is created through the other underlying object or the third scripting layer object.
11. A memory management device, characterized in that: include: A creation module, used to create a target underlying object, wherein the target underlying object is a data object implemented based on a compiled language; A processing module, configured to create a script layer object in response to a first script instruction, and set the target underlying object and the first script layer object to be in a mutually held state, wherein the first script layer object is a data object implemented based on a scripting language, the first script layer object is used to reference the target underlying object to implement a first target operation on the target underlying object, and the data object in the held state is continuously maintained in the memory; The recycling module is used to synchronously recycle the target underlying object and the first script layer object from the memory after the target condition is met.
12. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the memory management method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the memory management method according to any one of claims 1 to 10 is implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the memory management method according to any one of claims 1 to 10 is implemented.