CN110633141A - Memory management method and device of application program, terminal equipment and medium - Google Patents

Memory management method and device of application program, terminal equipment and medium Download PDF

Info

Publication number
CN110633141A
CN110633141A CN201910556098.1A CN201910556098A CN110633141A CN 110633141 A CN110633141 A CN 110633141A CN 201910556098 A CN201910556098 A CN 201910556098A CN 110633141 A CN110633141 A CN 110633141A
Authority
CN
China
Prior art keywords
memory
application program
operating system
additional
bitmap
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910556098.1A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Infinite Light Field Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Infinite Light Field Technology Co Ltd filed Critical Beijing Infinite Light Field Technology Co Ltd
Priority to CN201910556098.1A priority Critical patent/CN110633141A/en
Publication of CN110633141A publication Critical patent/CN110633141A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure discloses a memory management method and device of an application program, terminal equipment and a medium. In the method, in the running process of an application program, if a target event is detected, the application program sends an extra memory request to an operating system; the application program receives memory address information fed back by the operating system; and the application program responds to the target event in the target memory corresponding to the memory address information. By the method, the probability of collapse of the application program is reduced, the stability of the application program is improved, and the experience of a user in using the application program is improved.

Description

Memory management method and device of application program, terminal equipment and medium
Technical Field
The embodiment of the disclosure relates to the technical field of computers, and in particular, to a memory management method and device for an application program, a terminal device and a medium.
Background
With the popularization of terminal devices, application programs in the terminal devices are widely applied. When the application program is started, the application program applies for the memory from the terminal equipment so as to run in the applied memory.
During the running process of the application program, a large amount of target data such as bitmap or file stream occupying large memory is needed based on business requirements. When the application program loads the target data, the application program needs to apply for occupying the memory allocated to the application program by the terminal device. Because the memory allocated by the terminal device for the application program is limited, if the target data occupies too much memory, the application program is crashed, and the stability of the application program is reduced.
Disclosure of Invention
The disclosure provides a memory management method, device, terminal equipment and medium for an application program, which are used for improving the stability of the application program.
In a first aspect, an embodiment of the present disclosure provides a memory management method for an application program, including:
in the running process of an application program, if a target event is detected, the application program sends an extra memory request to an operating system;
the application program receives memory address information fed back by the operating system;
and the application program responds to the target event in the target memory corresponding to the memory address information.
In a second aspect, an embodiment of the present disclosure further provides an apparatus for managing a memory of an application program, where the apparatus for managing a memory of an application program includes: the sending module is used for sending an extra memory request to an operating system by the application program if a target event is detected in the running process of the application program;
the receiving module is used for receiving the memory address information fed back by the operating system by the application program;
and the response module is used for responding the target event in the target memory corresponding to the memory address information by the application program.
In a third aspect, an embodiment of the present disclosure further provides a terminal device, including:
one or more processing devices;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processing devices, the one or more processing devices are enabled to implement the memory management method for the application program according to the embodiment of the disclosure.
In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable medium, on which a computer program is stored, where the computer program, when executed by a processing apparatus, implements the memory management method of an application program according to the embodiment of the present disclosure.
The present disclosure provides a memory management method, apparatus, terminal device and medium for an application program, which can send an additional memory request to an operating system by the application program if a target event is detected during the running process of the application program; then the application program receives the memory address information fed back by the operating system; and the application program responds to the target event in the target memory corresponding to the memory address information. The method avoids occupying the memory allocated by the operating system for the application program operation (namely, the operating memory), reduces the probability of the application program crash, and improves the stability of the application program.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Fig. 1 is a schematic flowchart illustrating a memory management method for an application according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a memory management method for an application according to a second embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of memory management of an application according to a third embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a terminal device in the fourth embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Example one
Fig. 1 is a flowchart illustrating a method for managing a memory of an application according to an embodiment of the present disclosure, where the method is applicable to a case of managing the memory of the application. In particular, the method may be applicable to a case where additional memory in the application is managed, where the additional memory may include memory for responding to the target event. The method may be performed by a memory management device of an application, wherein the device may be implemented by software and/or hardware and is typically integrated on a terminal device.
As shown in fig. 1, a memory management method for an application according to a first embodiment of the present disclosure includes the following steps:
s110, in the running process of the application program, if a target event is detected, the application program sends an extra memory request to an operating system.
A target event may be understood as an event in an application that triggers the loading of target data. An extra memory request may be understood as a request for extra memory from an operating system by an application. The target data may be understood as data in a predetermined application program. The target data may be data occupying a relatively large memory, where specific content of the target data is not limited, and may be a bitmap and/or a file stream.
It can be understood that, when the application program is started, the memory for running the application program is applied to the terminal device. In this step, in order to avoid that the target data occupies too much memory that the application program applies for in advance to run the application program, when the target event is detected, an additional memory request may be sent to the operating system again to apply for additional memory.
The triggering of the target event is not limited, and those skilled in the art can determine the triggering means according to the specific content of the target event, for example, the target event can be triggered by the user operating the application program. Different business requirements can correspond to different target events, and specific contents and detection means of the target events are not limited here.
For example, the present embodiment may set a target event set, where the target event set includes an identifier of each target event in the application program. Upon detecting the target event, a user's operation of the application may be detected. When the identification information of the operation of the application by the user is included in the target event set, it can be considered that the target event is triggered by the current user.
Upon detecting the target event, the application may send an additional memory request to the operating system. The additional memory request may carry memory size information of the required memory, so that the operating system allocates memory for the application program based on the memory size information. In addition, the additional memory request may further include identification information of the application program, so that the operating system determines the application program to be allocated with the memory.
And S120, the application program receives the memory address information fed back by the operating system.
After the application program feeds back the memory address information to the operating system, the application program can wait for the operating system to allocate the memory for the application program. Specifically, the application program may receive memory address information fed back by the operating system to determine the target memory allocated by the operating system based on the memory address information. The memory address information may be understood as an address used to indicate the memory allocated by the operating system for the application program based on the additional memory request.
S130, the application program responds to the target event in the target memory corresponding to the memory address information.
After receiving the memory address information, the application program can respond to the target event in the target memory corresponding to the memory address information. Target memory may be understood as memory used in response to a target event. If the target event is a bitmap loading trigger event, bitmap loading can be performed in the target memory in the step. Different target events may have different response operations.
According to the memory management method for the application program, the application program can send an extra memory request to an operating system if a target event is detected in the running process of the application program; then the application program receives the memory address information fed back by the operating system; and the application program responds to the target event in the target memory corresponding to the memory address information. The method avoids occupying the memory allocated by the operating system for the application program operation (namely, the operating memory), reduces the probability of the application program crash, and improves the stability of the application program.
Further, the memory management method for the application program of this embodiment further includes:
and when the process responding to the target event stops or the application program is closed, releasing the target memory.
The target memory allocated by the operating system for the application may be released when the application shuts down or the process responding to the target event stops. If the target internal memory is released when the application program is closed and is not released when the process responding to the target event is stopped, the target internal memory can be used for running and using the application program after the process responding to the target event is stopped.
Example two
Fig. 2 is a schematic flow chart of a memory management method for an application program according to a second embodiment of the present disclosure, where the second embodiment is optimized based on the first embodiment. In this embodiment, the target event specifically includes a bitmap loading trigger event, and further the application program sends an extra memory request to the operating system specifically as follows: the application program acquires bitmap information of a bitmap triggered by the bitmap loading trigger event, wherein the bitmap information comprises memory size information;
and the application program sends an additional memory request corresponding to the bitmap information to an operating system.
Please refer to the first embodiment for a detailed description of the present embodiment.
As shown in fig. 2, a second embodiment of the present disclosure provides a memory management method for an application program, including the following steps:
and S210, detecting a bitmap loading trigger event in the running process of the application program.
In this embodiment, the target event includes a bitmap loading trigger event, and the target event is taken as the bitmap loading trigger event as an example for explanation, and a person skilled in the art may obtain the memory management methods of the other target data loading trigger events based on the memory management method of the bitmap loading trigger event.
A bitmap load trigger event may be understood as an event for triggering bitmap loading. The triggering manner of the bitmap loading triggering event is not limited. In the step, in the running process of the application program, a bitmap loading event is detected in real time so as to determine whether to send an extra memory request to an operating system.
Different bitmap loading trigger events can have different detection means, and the specific detection means can be determined according to business requirements. This step may determine whether there is a bitmap loading trigger event by detecting user operation on the application. Whether the bitmap loading triggering event is triggered is determined, such as through coordinate information of an operation point in a current page in an application program by a user.
S220, judging whether a bitmap loading trigger event is detected or not, if so, executing S230; if not, go to S210.
If a bitmap loading trigger event is detected, the application program sends an additional memory request to the operating system, i.e., executes S230, and if a bitmap loading trigger event is not detected, the bitmap loading trigger event may continue to be detected, i.e., executes S210.
And S230, the application program acquires bitmap information of a bitmap triggered by the bitmap loading triggering event, wherein the bitmap information comprises memory size information.
The bitmap triggered by the bitmap loading triggering event can be defined according to business requirements in the stage of developing the application program, and is not limited herein. The bitmap information may be understood as attribute information of the bitmap, such as memory size information of a memory required for loading the bitmap.
The application program may obtain the bitmap information locally from the terminal device or from the network. For example, if the bitmap triggered by the bitmap loading trigger event is stored locally, the bitmap information may be acquired from the terminal device locally based on the identification information of the view. The identification information may be used to uniquely identify the view; if the bitmap triggered by the bitmap loading trigger event is not stored locally, the bitmap and bitmap information can be obtained from the network. The bitmap information may be stored in a header file of data downloaded from the network, and this step may read the bitmap information in the header file.
S240, the application program sends an additional memory request corresponding to the bitmap information to an operating system.
And after acquiring bitmap information of a bitmap triggered by the bitmap loading triggering event, the application program sends an extra memory request to the operating system based on the bitmap information. Specifically, the extra memory request may include bitmap information or identification data corresponding to the bitmap information, so as to request a memory of a corresponding size from the operating system.
And S250, the application program receives the memory address information fed back by the operating system.
And S260, the application program responds to the target event in the target memory corresponding to the memory address information.
The following describes an exemplary memory management method for an application program according to this embodiment, which may be regarded as an implementation method for optimized bitmap memory management, generally, a bitmap memory application is in a memory allocated to each APP by a virtual machine, and generally, a bitmap occupies a memory relatively, and an APP is rushed when the memory occupies too much. In the example, JNI is used to manage the bitmap independently, the memory resource applied is not the memory of the APP allocated by the virtual machine, but the memory outside the memory allocated for the APP in the virtual machine, and the size of the bitmap memory is managed, and the bitmap memory is managed by setting the maximum limit according to the LRU algorithm.
Specifically, loading a local picture of the mobile phone or downloading a picture from a network requires decoding the picture into a bitmap format for loading, and the bitmap occupies a large memory on the android mobile phone. Generally, the Memory required by the android program is applied on the java heap, the android virtual machine has size limitation on the java heap, even though the RAM may have residual space, if the Memory applied by the application process exceeds the limitation, the Memory will overflow (Out of Memory, oom), and then the Memory can be applied and managed by using a JNI interface or a MALLOc method.
The second memory management method for the application program provided in the embodiment of the present disclosure embodies the operation of sending an additional memory request. When the method is used for detecting the bitmap loading trigger event, an additional memory request is sent to the operating system based on the bitmap information, the target event is responded in the target memory corresponding to the additional memory request, and the bitmap is subjected to independent memory management, so that the bitmap loading does not occupy the running memory of the application program, the probability of collapse of the application program is reduced, and the stability of the application program is improved.
Further, the embodiment also embodies an operation of managing the additional memory, specifically: the application program determines additional size information of an additional memory, wherein the additional memory comprises a memory allocated to the application program by the operating system after receiving an additional memory request each time;
and if the extra size information is a set threshold value, managing the extra memory.
The extra memory may represent the memory that the application is currently applying to the operating system in response to the target event. The application determines the additional size information of the additional memory for determining whether the application upper limit is currently reached. The means for determining the extra size information of the extra memory by the application program is not limited, for example, the application program may count the memory address information fed back by the operating system each time to determine the extra size information.
If the extra size information is the set threshold, the application program can be considered to reach the application upper limit, so that extra memory needs to be managed. Such as removing data from less used memory to obtain free memory for responding to the target event.
The means for managing the additional memory is not limited, and those skilled in the art can select a corresponding memory management method according to actual situations to manage the memory, for example, the Least Recently Used (LRU) algorithm is Used to manage the memory. The LRU algorithm is a page replacement algorithm for memory management, and the operating system moves data that is in additional memory but not in use out of the additional memory to make room for loading additional data.
The execution time of the operation for managing the extra memory is not limited, and the operation can be executed in real time or after a target event is detected each time.
If after detecting the target event, the application sends an additional memory request to the operating system upon determining that the additional size information is not a set threshold. And when the extra size information is determined to be the set threshold, managing the extra memory so as to use the managed idle memory, namely responding to the target event by the idle memory. That is, the operating system sets the limit value of the memory that can be applied by the application program, that is, sets the threshold value. When the total size of the extra memory allocated by the operating system for the application program is equal to the set threshold, no extra memory is allocated for the application program.
Further, the sending, by the application program, an additional memory request corresponding to the bitmap information to an operating system includes:
the application program determines an additional memory request according to the memory size information, and the size of an additional requested memory of the additional memory request is determined according to the memory size information;
the application program sends the additional memory request to an operating system.
When the application program sends an additional memory request corresponding to the bitmap information to the operating system, the additional memory request may be determined according to the memory size information, for example, the size of the additionally requested memory requested by the additional memory request is determined.
Illustratively, the application program obtains an additional memory request including the memory size information according to the memory size information to request a memory of a corresponding size from the operating system.
The means used by the application program to send the additional memory request to the operating system is not limited, and the memory may be applied by using a JNI interface or using a dynamic memory allocation (malloc) method. When the application program runs under an android operating system, a memory can be applied by adopting a JNI interface, the JNI interface can be understood as a Java localization interface, the interaction of Java codes and codes written by other languages can be realized, and for example, a plurality of APIs are provided to realize the communication of Java and other languages (mainly C & C + +). The embodiment may also implement the memory application by using an anonymous shared memory mechanism. The anonymous shared memory is a mechanism for sharing the memory, and the mmap system call of Linux is utilized to map the same physical memory in different processes to respective virtual address spaces of the processes, so that the efficient inter-process sharing is realized.
Further, the application uses a localization interface to implement the sending of the additional memory request.
In this embodiment, a localized interface may be optionally used to send the additional memory request. When the operating system is an android system, the localization interface can be a JNI interface, and management of the memory of the target data is achieved through the JNI interface.
Further, managing the additional memory includes:
selecting an idle memory with the utilization rate lower than a set threshold value from target memories included in the additional memories;
and releasing the idle memory.
When managing the additional memory, the idle memory may be selected from the target memories included in the additional memory according to the usage rate of each target memory. The additional memory includes the target memory allocated by the operating system to the application each time. When managing the additional memory, the utilization rate of each target memory can be determined, and the target memory with the utilization rate in a preset interval is selected as the idle memory. The determination of the preset interval is not limited.
Idle memory may be understood as the cutoff of memory that is currently less used. In the example, the idle memory is released, that is, the data residing in the memory is released from the memory, so that the management of the additional memory is realized, and the utilization rate of the memory resource is improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of memory management of an application according to a third embodiment of the present disclosure, where the apparatus is applicable to a case of managing a memory of an application. In particular, the apparatus may be adapted to manage additional memory in an application, where the additional memory may include memory for responding to a target event. Wherein the means can be implemented by software and/or hardware and are typically integrated on the terminal device.
As shown in fig. 3, the apparatus includes: a sending module 31, a receiving module 32 and a response module 33;
the sending module 31 is configured to, in an application program running process, send an additional memory request to an operating system by an application program if a target event is detected;
a receiving module 32, configured to receive, by the application program, memory address information fed back by the operating system;
a response module 33, configured to respond, by the application program, the target event in the target memory corresponding to the memory address information.
In this embodiment, the apparatus firstly sends, by using the sending module 31, an additional memory request to the operating system if a target event is detected during the running of the application; then the receiving module 32 receives the memory address information fed back by the operating system through the application program; finally, the response module 33 responds to the target event in the target memory corresponding to the memory address information through the application program.
The embodiment provides a memory management device for an application program, which can send an additional memory request to an operating system by the application program if a target event is detected in the running process of the application program; then the application program receives the memory address information fed back by the operating system; and the application program responds to the target event in the target memory corresponding to the memory address information. The method avoids occupying the memory allocated by the operating system for the application program operation (namely, the operating memory), reduces the probability of the application program crash, and improves the stability of the application program.
Further, the target event comprises a bitmap loading trigger event; accordingly, the sending module 31 includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring bitmap information of a bitmap triggered by a bitmap loading trigger event by an application program if a target event is detected in the running process of the application program, and the bitmap information comprises memory size information;
and the sending unit is used for sending the extra memory request corresponding to the bitmap information to an operating system by the application program.
Further, the sending unit is specifically configured to:
the application program determines an additional memory request according to the memory size information, and the size of an additional requested memory of the additional memory request is determined according to the memory size information;
the application program sends the additional memory request to an operating system.
Further, the application uses a localization interface to implement the sending of the additional memory request.
Further, the apparatus further comprises: a determining module, configured to determine, by the application program, additional size information of an additional memory, where the additional memory includes a memory allocated by the operating system for the application program after receiving an additional memory request each time;
and if the extra size information is a set threshold value, managing the extra memory.
Further, when the determining module manages the additional memory, the method specifically includes:
selecting an idle memory with the utilization rate lower than a set threshold value from target memories included in the additional memories;
and releasing the idle memory.
Further, the apparatus further comprises: and the release module is used for releasing the target memory when the process responding to the target event stops or the application program is closed.
The memory management device of the application program can execute the memory management method of the application program provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of a terminal device in a fourth embodiment of the present disclosure, and referring to fig. 4, a schematic structural diagram of a terminal device 400 suitable for implementing the fourth embodiment of the present disclosure is shown. The terminal device 400 in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), etc., and a stationary terminal such as a digital TV, a desktop computer, etc. The terminal device 400 shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the terminal device 400 may include a processing means (e.g., a central processing unit, a graphic processor, etc.) 401 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage means 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the terminal apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the terminal device 400 to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 illustrates a terminal apparatus 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 401.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be included in the terminal device; or may exist separately without being assembled into the terminal device.
The computer readable medium carries one or more programs which, when executed by the terminal device, cause the terminal device to: in the running process of an application program, if a target event is detected, the application program sends an extra memory request to an operating system;
the application program receives memory address information fed back by the operating system;
and the application program responds to the target event in the target memory corresponding to the memory address information.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above 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 a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The 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, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Example 1 provides a memory management method of an application program, including:
in the running process of an application program, if a target event is detected, the application program sends an extra memory request to an operating system;
the application program receives memory address information fed back by the operating system;
and the application program responds to the target event in the target memory corresponding to the memory address information.
Example 2 the method of example 1, the target event comprising a bitmap load trigger event; correspondingly, the sending, by the application program, an additional memory request to the operating system includes:
the application program acquires bitmap information of a bitmap triggered by the bitmap loading trigger event, wherein the bitmap information comprises memory size information;
and the application program sends an additional memory request corresponding to the bitmap information to an operating system.
Example 3 the method of example 2, wherein sending, by the application program to the operating system, an additional memory request corresponding to the bitmap information comprises:
the application program determines an additional memory request according to the memory size information, and the size of an additional requested memory of the additional memory request is determined according to the memory size information;
the application program sends the additional memory request to an operating system.
Example 4 the method of example 3, the application implementing the sending of the additional memory request using a localization interface, according to one or more embodiments of the present disclosure.
Example 5 the method of example 1, in accordance with one or more embodiments of the present disclosure, further comprising: the application program determines additional size information of an additional memory, wherein the additional memory comprises a memory allocated to the application program by the operating system after receiving an additional memory request each time;
and if the extra size information is a set threshold value, managing the extra memory.
Example 6 managing the additional memory according to the method of example 5, in accordance with one or more embodiments of the present disclosure includes:
selecting an idle memory with the utilization rate lower than a set threshold value from target memories included in the additional memories;
and releasing the idle memory.
Example 7 the method of example 1, in accordance with one or more embodiments of the present disclosure, further comprising:
and when the process responding to the target event stops or the application program is closed, releasing the target memory.
Example 8 provides a memory management apparatus for an application according to one or more embodiments of the present disclosure, including:
the sending module is used for sending an extra memory request to an operating system by the application program if a target event is detected in the running process of the application program;
the receiving module is used for receiving the memory address information fed back by the operating system by the application program;
and the response module is used for responding the target event in the target memory corresponding to the memory address information by the application program.
Example 9 provides, in accordance with one or more embodiments of the present disclosure, a terminal device, comprising:
one or more processing devices;
storage means for storing one or more programs;
when executed by the one or more processing devices, cause the one or more processing devices to implement the memory management method for an application program as in any of examples 1-7.
Example 10 provides a computer-readable medium having stored thereon a computer program that, when executed by a processing apparatus, implements a memory management method for an application program as in any of examples 1-7.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A memory management method for an application program is characterized by comprising the following steps:
in the running process of an application program, if a target event is detected, the application program sends an extra memory request to an operating system;
the application program receives memory address information fed back by the operating system;
and the application program responds to the target event in the target memory corresponding to the memory address information.
2. The method of claim 1, wherein the target event comprises a bitmap load trigger event; correspondingly, the sending, by the application program, an additional memory request to the operating system includes:
the application program acquires bitmap information of a bitmap triggered by the bitmap loading trigger event, wherein the bitmap information comprises memory size information;
and the application program sends an additional memory request corresponding to the bitmap information to an operating system.
3. The method of claim 2, wherein sending, by the application program to the operating system, an additional memory request corresponding to the bitmap information comprises:
the application program determines an additional memory request according to the memory size information, and the size of an additional requested memory of the additional memory request is determined according to the memory size information;
the application program sends the additional memory request to an operating system.
4. The method of claim 3, wherein the application uses a localization interface to implement the sending of the additional memory request.
5. The method of claim 1, further comprising:
the application program determines additional size information of an additional memory, wherein the additional memory comprises a memory allocated to the application program by the operating system after receiving an additional memory request each time;
and if the extra size information is a set threshold value, managing the extra memory.
6. The method of claim 5, wherein managing the additional memory comprises:
selecting an idle memory with the utilization rate lower than a set threshold value from target memories included in the additional memories;
and releasing the idle memory.
7. The method of claim 1, further comprising:
and when the process responding to the target event stops or the application program is closed, releasing the target memory.
8. A memory management device for an application program, comprising:
the sending module is used for sending an extra memory request to an operating system by the application program if a target event is detected in the running process of the application program;
the receiving module is used for receiving the memory address information fed back by the operating system by the application program;
and the response module is used for responding the target event in the target memory corresponding to the memory address information by the application program.
9. A terminal device, comprising:
one or more processing devices;
storage means for storing one or more programs;
when executed by the one or more processing devices, cause the one or more processing devices to implement the memory management method for an application program of any of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processing means, carries out a memory management method for an application program according to any one of claims 1 to 7.
CN201910556098.1A 2019-06-25 2019-06-25 Memory management method and device of application program, terminal equipment and medium Pending CN110633141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910556098.1A CN110633141A (en) 2019-06-25 2019-06-25 Memory management method and device of application program, terminal equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910556098.1A CN110633141A (en) 2019-06-25 2019-06-25 Memory management method and device of application program, terminal equipment and medium

Publications (1)

Publication Number Publication Date
CN110633141A true CN110633141A (en) 2019-12-31

Family

ID=68968347

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910556098.1A Pending CN110633141A (en) 2019-06-25 2019-06-25 Memory management method and device of application program, terminal equipment and medium

Country Status (1)

Country Link
CN (1) CN110633141A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736997A (en) * 2020-06-18 2020-10-02 北京达佳互联信息技术有限公司 Memory allocation method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1619584A1 (en) * 2004-02-13 2006-01-25 Jaluna SA Memory allocation
CN105808219A (en) * 2014-12-29 2016-07-27 中国移动通信集团公司 Memory space allocation method and apparatus
CN107085548A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of method, device and electronic equipment for monitoring application program internal memory
CN108762919A (en) * 2018-05-17 2018-11-06 桂林长海发展有限责任公司 A kind of program internal memory processing system and method
CN109669877A (en) * 2018-12-11 2019-04-23 腾讯科技(深圳)有限公司 EMS memory management process, device, terminal and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1619584A1 (en) * 2004-02-13 2006-01-25 Jaluna SA Memory allocation
CN105808219A (en) * 2014-12-29 2016-07-27 中国移动通信集团公司 Memory space allocation method and apparatus
CN107085548A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of method, device and electronic equipment for monitoring application program internal memory
CN108762919A (en) * 2018-05-17 2018-11-06 桂林长海发展有限责任公司 A kind of program internal memory processing system and method
CN109669877A (en) * 2018-12-11 2019-04-23 腾讯科技(深圳)有限公司 EMS memory management process, device, terminal and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736997A (en) * 2020-06-18 2020-10-02 北京达佳互联信息技术有限公司 Memory allocation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111475235B (en) Acceleration method, device, equipment and storage medium for function calculation cold start
CN109101335B (en) Extending functionality of a host device
CN111221638B (en) Concurrent task scheduling processing method, device, equipment and medium
CN115237589A (en) SR-IOV-based virtualization method, device and equipment
CN115599707A (en) Memory management method, device, medium and electronic equipment
CN115904761A (en) System on chip, vehicle and video processing unit virtualization method
CN114625536A (en) Video memory allocation method, device, medium and electronic equipment
CN110633141A (en) Memory management method and device of application program, terminal equipment and medium
CN112306685A (en) Task isolation method and device, electronic equipment and computer readable medium
CN113518183B (en) Camera calling method and device and electronic equipment
CN111813541B (en) Task scheduling method, device, medium and equipment
CN110502891B (en) Method, device, medium and electronic equipment for acquiring process memory leakage
CN110427135B (en) Method, device, terminal and storage medium for determining application call
CN111949528A (en) Memory leak detection method and device, electronic equipment and storage medium
CN111538721A (en) Account processing method and device, electronic equipment and computer readable storage medium
CN112860439A (en) Application starting method and device, terminal and storage medium
CN113391860A (en) Service request processing method and device, electronic equipment and computer storage medium
CN111240758A (en) Material display method and device, electronic equipment and storage medium
CN110300163B (en) Method, device, equipment and storage medium for acquiring network data
CN117093149A (en) Memory management method, device, medium and electronic equipment
CN118034602A (en) Method, device, electronic equipment and storage medium for storing request data
CN117149450A (en) Message processing method, device, equipment and computer readable storage medium
CN116339846A (en) Process management method and device, storage medium and electronic equipment
CN113407309A (en) Virtual machine memory application method and device, storage medium and electronic equipment
CN117992204A (en) Memory detection method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20230425

Address after: Room 802, Information Building, 13 Linyin North Street, Pinggu District, Beijing, 101299

Applicant after: Beijing youzhuju Network Technology Co.,Ltd.

Address before: No. 715, 7th floor, building 3, 52 Zhongguancun South Street, Haidian District, Beijing 100081

Applicant before: Beijing infinite light field technology Co.,Ltd.