CN104375828B - Memory Optimize Method and device - Google Patents

Memory Optimize Method and device Download PDF

Info

Publication number
CN104375828B
CN104375828B CN201410584383.1A CN201410584383A CN104375828B CN 104375828 B CN104375828 B CN 104375828B CN 201410584383 A CN201410584383 A CN 201410584383A CN 104375828 B CN104375828 B CN 104375828B
Authority
CN
China
Prior art keywords
memory
function
address
application program
absolute address
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.)
Active
Application number
CN201410584383.1A
Other languages
Chinese (zh)
Other versions
CN104375828A (en
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.)
Xiaomi Inc
Original Assignee
Xiaomi Inc
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 Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201410584383.1A priority Critical patent/CN104375828B/en
Publication of CN104375828A publication Critical patent/CN104375828A/en
Application granted granted Critical
Publication of CN104375828B publication Critical patent/CN104375828B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The disclosure belongs to field of computer technology about a kind of Memory Optimize Method and device.The method includes:The internal memory optimization code for carrying program identification and memory release function is received, program identification is that application program occupies in front stage operation and is not required to the memory occupied in running background for identifying the application program for needing releasing idling memory, free memory;Whether from foreground it is switched to running background by internal memory optimization code detection application program;If go out application program by internal memory optimization code detection is switched to running background from foreground, function is discharged by application call memory, memory discharges function and is used for releasing idling memory.Described device includes:Code receiving module, state detection module and function call module.The disclosure solves the problem of just triggering memory source recycling in terminal low memory, terminal is caused to be constantly in memory source tense situation, has achieved the effect that the processing capacity for improving terminal.

Description

Memory Optimize Method and device
Technical field
This disclosure relates to field of computer technology, more particularly to a kind of Memory Optimize Method and device.
Background technology
The occupied memory source of application program run by Virtual Machine Manager in JAVA.It is operated in when application program launching Foreground, a large amount of memories can be occupied by carrying out initialization, into steady operation period after go to running background, need not occupy at this time a large amount of Memory, and idle memory is still occupied by application program, virtual machine can just be recovered these memories by processing for a long time. Therefore, it in the case of memory inadequate resource, needs quickly to recycle idle memory source.
When progress memory source quickly recycles, the application program of all operations of terminal-pair is detected, if it is detected that institute There is the memory source value that the application program of operation occupies to be more than first threshold, then each application program run in system is distinguished It is detected, if detect the presence of the occupied memory source value of some application program more than second threshold, terminates this and answer With the operation of program, the occupied memory of the application program is recycled.
During realizing the disclosure, discovery at least has the following defects publisher in the related technology:In terminal memory Memory source recycling can be just triggered when insufficient, caused terminal to be constantly in memory source tense situation, reduced the processing of terminal Ability.
Invention content
To solve just trigger memory source recycling in terminal low memory, terminal is caused to be constantly in memory source tight The problem of state of opening, present disclose provides a kind of Memory Optimize Method and devices.
According to the first aspect of the embodiments of the present disclosure, a kind of Memory Optimize Method is provided, including:
The internal memory optimization code for carrying program identification and memory release function is received, described program mark is needed for identifying It is that the application program is occupied in front stage operation and transported on backstage to want the application program of releasing idling memory, the free memory The memory occupied is not required to when row;
Whether from foreground it is switched to running background by application program described in the internal memory optimization code detection;
If go out the application program by the internal memory optimization code detection is switched to running background from foreground, pass through institute It states memory described in application call and discharges function, the memory release function is for discharging the free memory.
Optionally, if memory release function is in the private function for forbidding editing mode, the method is also wrapped It includes:
Obtain the absolute address of the Public Function of the application call, wherein the Public Function, which has, calls institute State the permission of memory release function;
The absolute address of the Public Function is shown, the absolute address of the Public Function, which is used to indicate, calculates institute It states the absolute address of memory release function and the absolute address of memory release function is added to the internal memory optimization code In, the absolute address of memory release function is equal to the absolute address of the Public Function plus the Public Function and described Memory discharges the relative address of function, and the Public Function and the memory discharge the relative address of function by preset symbol table It provides.
Optionally, the absolute address of the Public Function for obtaining the application call, including:
Read instruction in the address for receiving the function identification for carrying described program mark and the Public Function;
In dynamic link library, the absolute address of the Public Function of the application call is searched.
Optionally, described that function is discharged by memory described in the application call, including:
The absolute address that the memory is discharged to function by the internal memory optimization code is sent to the application program;
Under the instruction for discharging the absolute address of function in the memory, discharged by memory described in the application call Function.
Optionally, memory release function be in allow the private function of editing mode into obtaining after edlin Public Function.
According to the second aspect of the embodiment of the present disclosure, a kind of internal memory optimization device is provided, including:
Code receiving module is configured as receiving the internal memory optimization code for carrying program identification and memory release function, For described program mark for identifying the application program for needing releasing idling memory, the free memory is the application program preceding It is occupied when platform is run and is not required to the memory occupied in running background;
State detection module is configured as the internal memory optimization code detection institute received by the code receiving module State whether application program from foreground is switched to running background;
Function call module is configured as going out by the internal memory optimization code detection when the state detection module described When application program is switched to running background from foreground, function, the memory are discharged by memory described in the application call Release function is for discharging the free memory.
Optionally, when memory release function is in the private function for forbidding editing mode, described device is also wrapped It includes:
Address acquisition module is configured as obtaining the absolute address of the Public Function of the application call, wherein institute Stating Public Function has the permission for calling the memory release function;
Address display module, be configured as the absolute address of the Public Function that described address acquisition module is obtained into Row display, the absolute address of the Public Function are used to indicate the absolute address for calculating the memory release function and will be described interior The absolute address for depositing release function is added in the internal memory optimization code, and the absolute address of the memory release function is equal to institute The absolute address of Public Function is stated plus the relative address of the Public Function and memory release function, the Public Function The relative address that function is discharged with the memory is provided by preset symbol table.
Optionally, described address acquisition module, including:
Command reception submodule is configured as receiving the function identification for carrying described program mark and the Public Function Address read instruction;
Address search submodule, is configured as in dynamic link library, searches the institute of described instruction receiving submodule instruction State the absolute address of the Public Function of application call.
Optionally, the function call module, including:
Address sending submodule is configured as that the memory is discharged function utterly by the internal memory optimization code Location is sent to the application program;
Function call submodule, the memory for being configured as sending in described address sending submodule discharge the exhausted of function To under the instruction of address, discharging function by memory described in the application call.
Optionally, memory release function be in allow the private function of editing mode into obtaining after edlin Public Function.
According to the third aspect of the embodiment of the present disclosure, a kind of internal memory optimization device is provided, including:
Processor;
Memory for storing processor-executable instruction;
Wherein, the processor is configured as:
The internal memory optimization code for carrying program identification and memory release function is received, described program mark is needed for identifying It is that the application program is occupied in front stage operation and transported on backstage to want the application program of releasing idling memory, the free memory The memory occupied is not required to when row;
Whether from foreground it is switched to running background by application program described in the internal memory optimization code detection;
If go out the application program by the internal memory optimization code detection is switched to running background from foreground, pass through institute It states memory described in application call and discharges function, the memory release function is for discharging the free memory.
The technical scheme provided by this disclosed embodiment can include the following benefits:
The internal memory optimization code of program identification and memory release function is carried by receiving, the program identification is for identifying The application program of releasing idling memory is needed, which is that application program is occupied in front stage operation and in running background It is not required to the memory occupied;Whether from foreground it is switched to running background by internal memory optimization code detection application program;If by interior It deposits Optimized code and detects that application program is switched to running background from foreground, then function is discharged by application call memory, The memory discharge function be used for releasing idling memory, can directly invoke include memory release function internal memory optimization code, The free memory of application program is discharged, memory source recycling can just be triggered in terminal low memory by solving, and be caused Terminal is constantly in the problem of memory source tense situation, has achieved the effect that the processing capacity for improving terminal.
It should be understood that above general description and following detailed description is merely exemplary, this can not be limited It is open.
Description of the drawings
The drawings herein are incorporated into the specification and constitutes a part for present disclosure specification, shows and meets the disclosure Embodiment, and together with specification for explaining the principles of this disclosure.
Fig. 1 is a kind of flow chart of Memory Optimize Method shown according to an exemplary embodiment.
Fig. 2 is a kind of flow chart of the Memory Optimize Method shown according to another exemplary embodiment.
Fig. 3 is a kind of block diagram of internal memory optimization device shown according to an exemplary embodiment.
Fig. 4 is a kind of block diagram of internal memory optimization device shown according to an exemplary embodiment.
Fig. 5 is a kind of block diagram of device for internal memory optimization shown according to an exemplary embodiment.
Specific implementation mode
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment Described in embodiment do not represent all implementations consistent with this disclosure.On the contrary, they be only with it is such as appended The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
Fig. 1 is a kind of flow chart of Memory Optimize Method shown according to an exemplary embodiment, the Memory Optimize Method Applied in terminal, as shown in Figure 1, the Memory Optimize Method includes the following steps.
In a step 101, the internal memory optimization code for carrying program identification and memory release function, the program identification are received For identifying the application program for needing releasing idling memory, which is that application program is occupied in front stage operation and rear Platform is not required to the memory occupied when running.
Memory release function is that have the function of the free memory of determining application program occupancy and discharge the free memory Function.
In a step 102, whether running background from foreground is switched to by internal memory optimization code detection application program.
Foreground is operated in when application program launching, carry out initialization can occupy a large amount of memories, into steady operation period after turn To running background, a large amount of memories need not be occupied at this time, and free memory is still occupied by application program, at this point it is possible to pass through Internal memory optimization code carrys out releasing idling memory.
Using internal memory optimization code discharge application program free memory before, terminal need detect application program whether from Foreground is switched to running background, so that it is determined that application program whether there is free memory.
In step 103, if go out application program by internal memory optimization code detection is switched to running background from foreground, lead to Application call memory release function is crossed, which discharges function and be used for releasing idling memory.
In conclusion the Memory Optimize Method that the disclosure provides, program identification and memory release letter are carried by receiving Several internal memory optimization codes, for the program identification for identifying the application program for needing releasing idling memory, which is to answer It is occupied in front stage operation with program and is not required to the memory occupied in running background;Pass through internal memory optimization code detection application journey Whether sequence from foreground is switched to running background;It is transported if going out application program by internal memory optimization code detection and being switched to backstage from foreground Row, then discharge function by application call memory, which discharges function and be used for releasing idling memory, can directly invoke Include the internal memory optimization code of memory release function, the free memory of application program is discharged, is solved in terminal The problem of memory source recycling can just be triggered when depositing deficiency, terminal is caused to be constantly in memory source tense situation, reaches and carried The effect of the processing capacity of high terminal.
Fig. 2 is a kind of flow chart of the Memory Optimize Method shown according to another exemplary embodiment, the internal memory optimization side Method is applied in terminal, as shown in Fig. 2, the Memory Optimize Method includes the following steps.
In step 201, if memory release function is to obtain application program in the private function for forbidding editing mode The absolute address of the Public Function of calling, wherein the Public Function has the permission for calling memory release function;To Public Function Absolute address shown that the absolute address of the Public Function is used to indicate the absolute address for calculating memory release function and will The absolute address of memory release function is added in internal memory optimization code, and the absolute address which discharges function is equal to publicly-owned letter Several absolute address is plus the relative address of Public Function and memory release function, the phase of the Public Function and memory release function Address is provided by preset symbol table.
It is private function that memory, which discharges function in virtual machine source code, is in the free time for determining application program occupancy The function of the function of the free memory is deposited and discharges, which is that application program is occupied in front stage operation and transported on backstage The memory occupied is not required to when row.Public Function is with the function for the permission for calling memory release function, and absolute address is function It is loaded into the memory address that system after application program is function distribution.
When application program is run on a virtual machine, the occupied sky of function pair application program is discharged by virtual machine call memory Not busy memory is discharged, since virtual machine needs that by the processing of some time memory could be recycled, terminal can be direct The release function of the memory in virtual machine is called to carry out releasing idling memory.If memory release function is in the private for forbidding editing mode There is function, that is, it is not editable source code that memory, which discharges function, at this point, in order to call the memory to discharge function, terminal The absolute address of memory release function when needing to obtain application program operation.
Due to the relative address that Public Function and memory discharge function be it is fixed, can pass through and obtain publicly-owned letter Several absolute address come obtain memory discharge function absolute address.Therefore, terminal needs to obtain the absolute address of Public Function The relative address of function is discharged with Public Function and memory.
Wherein, the absolute address of the Public Function of application call is obtained, including:
1) the address reading instruction for carrying program identification and the function identification of Public Function is received;
2) in dynamic link library, the absolute address of the Public Function of application call is searched.
When Public Function is by application call, system can be the Public Function storage allocation address, and terminal is interior by this It deposits address and is determined as the absolute address of the Public Function and be stored in dynamic link library.When needing to obtain the absolute of the Public Function When address, terminal can directly read the absolute address from dynamic link library.
When due to Public Function by different application calls, system can be for the Public Function with distributing different memories Location, therefore, when obtaining the Public Function of some application call, it is also necessary to obtain the program identification of the application program. That is, the address that receives of terminal, which is read, needs to carry program identification and the function identification of Public Function in instruction, terminal according to Program identification and function identification search the absolute address of the Public Function in dynamic link library, and are shown to the absolute address Show.
It should be noted that before function identification is added to address acquisition instruction, user can be virtual by checking Machine source code finds the call function for the free memory that release virtual machine occupies, then by checking that the header file of virtual machine is determined Having in the call function calls the Public Function of the permission of memory release function, and the function identification of the Public Function is added Into address acquisition instruction.
When obtaining the relative address of Public Function and private function, since Public Function and memory discharge the opposite of function Address is provided by preset symbol table, therefore, user can by checking the symbol table, reading need the Public Function with it is privately owned The relative address of function.Wherein, which is obtained by the libraries symbol by objdump.
After the absolute address and Public Function that Public Function is determined discharge the relative address of function with memory, the memory The absolute address of release function can be determined that the absolute address of Public Function discharges function plus Public Function and memory Relative address.Therefore, the absolute address for the Public Function that terminal is shown is got in user, and, it is read from symbol table After the relative address of Public Function and private function, the absolute address of Public Function can be added relative address by user, be obtained The absolute address of private function.
In step 202, the internal memory optimization code for carrying program identification and memory release function, the program identification are received For identifying the application program for needing releasing idling memory, which is that application program is occupied in front stage operation and rear Platform is not required to the memory occupied when running.
After determining the absolute address that memory discharges function, user can discharge the absolute address of function and be answered according to memory Internal memory optimization code is write with the program identification of program, which is sent to terminal, terminal receives the memory After Optimized code, internal memory optimization is carried out according to the internal memory optimization code.
In step 203, whether running background from foreground is switched to by internal memory optimization code detection application program.
Foreground is operated in when application program launching, carry out initialization can occupy a large amount of memories, into steady operation period after turn To running background, a large amount of memories need not be occupied at this time, and idle memory is still occupied by application program, at this point it is possible to logical It crosses internal memory optimization code and carrys out releasing idling memory.
Using internal memory optimization code discharge application program free memory before, terminal need detect application program whether from Foreground is switched to running background, so that it is determined that application program whether there is free memory.Detection detection application program whether from It, can be by the current state of internal memory optimization Code obtaining application program, if application program is worked as when foreground is switched to running background Preceding state is to hang up, it is determined that application program is in running background, if the current state of application program is operation, it is determined that apply journey Sort run is on foreground.
In step 204, if go out application program by internal memory optimization code detection is switched to running background from foreground, lead to Application call memory release function is crossed, which discharges function and be used for releasing idling memory.
If terminal goes out application program by internal memory optimization code detection is switched to running background from foreground, it is determined that the application There are free memory, terminals to discharge function by application call memory and discharge the free memory that application program occupies for program.
Wherein, function is discharged by application call memory, including:
1) absolute address that memory is discharged to function by internal memory optimization code is sent to application program;
2) under the instruction of absolute address for discharging function in memory, function is discharged by application call memory.
The instruction for carrying the absolute address that the memory discharges function is sent to application by terminal operating internal memory optimization code Program so that application program can call memory to discharge function under the absolute address instruction that memory discharges function, to discharge The occupied free memory of application program.
In another embodiment, terminal does not execute step 201, i.e. terminal executes step 202-204, at this point, memory Release function be in allow the private function of editing mode into the Public Function obtained after edlin.That is, memory discharges letter Number is editable Open Source Code, then user can discharge memory function into edlin so that memory release function becomes can Directly by the Public Function of application call, at this point, memory release function is Public Function.
It is excellent that the Public Function obtained after the editor and the corresponding program identification of application program can be added to memory by user Change in code, after terminal enters backstage by internal memory optimization code detection to application program, terminal operating internal memory optimization code, Memory release function is sent to application program so that application program directly invokes memory release function, release application program institute The free memory of occupancy, the absolute address without discharging function by memory call memory to discharge function, improve release The efficiency of the free memory of application program.
In conclusion the Memory Optimize Method that the disclosure provides, program identification and memory release letter are carried by receiving Several internal memory optimization codes, for the program identification for identifying the application program for needing releasing idling memory, which is to answer It is occupied in front stage operation with program and is not required to the memory occupied in running background;Pass through internal memory optimization code detection application journey Whether sequence from foreground is switched to running background;It is transported if going out application program by internal memory optimization code detection and being switched to backstage from foreground Row, then discharge function by application call memory, which discharges function and be used for releasing idling memory, can directly invoke Include the internal memory optimization code of memory release function, the free memory of application program is discharged, is solved in terminal The problem of memory source recycling can just be triggered when depositing deficiency, terminal is caused to be constantly in memory source tense situation, reaches and carried The effect of the processing capacity of high terminal.
In addition, memory release function be in allow the private function of editing mode into the publicly-owned letter obtained after edlin Edited memory release function can directly be added in internal memory optimization code by number, user, and internal memory optimization code can be straight It connects and calls memory release function, the absolute address without discharging function by memory calls memory to discharge function, improves Discharge the efficiency of the free memory of application program.
Fig. 3 is a kind of block diagram of internal memory optimization device shown according to an exemplary embodiment, which answers For in terminal, as shown in figure 3, the internal memory optimization device includes:Code receiving module 310, state detection module 320 and function Calling module 330.
The code receiving module 310 is configured as receiving the internal memory optimization for carrying program identification and memory release function Code, for program identification for identifying the application program for needing releasing idling memory, free memory is application program in front stage operation Shi Zhanyong and the memory that occupancy is not required in running background;
The state detection module 320 is configured as answering by the internal memory optimization code detection that code receiving module 310 receives Whether from foreground it is switched to running background with program;
The function call module 330 is configured as going out application by internal memory optimization code detection when state detection module 320 When program is switched to running background from foreground, function is discharged by application call memory, memory release function is for discharging Free memory.
In conclusion the internal memory optimization device that the disclosure provides, program identification and memory release letter are carried by receiving Several internal memory optimization codes, for the program identification for identifying the application program for needing releasing idling memory, which is to answer It is occupied in front stage operation with program and is not required to the memory occupied in running background;Pass through internal memory optimization code detection application journey Whether sequence from foreground is switched to running background;It is transported if going out application program by internal memory optimization code detection and being switched to backstage from foreground Row, then discharge function by application call memory, which discharges function and be used for releasing idling memory, can directly invoke Include the internal memory optimization code of memory release function, the free memory of application program is discharged, is solved in terminal The problem of memory source recycling can just be triggered when depositing deficiency, terminal is caused to be constantly in memory source tense situation, reaches and carried The effect of the processing capacity of high terminal.
Fig. 4 is a kind of block diagram of internal memory optimization device shown according to an exemplary embodiment, which answers For in terminal, as shown in figure 4, the internal memory optimization device includes:Code receiving module 310, state detection module 320 and function Calling module 330.
The code receiving module 310 is configured as receiving the internal memory optimization for carrying program identification and memory release function Code, for program identification for identifying the application program for needing releasing idling memory, free memory is application program in front stage operation Shi Zhanyong and the memory that occupancy is not required in running background;
The state detection module 320 is configured as answering by the internal memory optimization code detection that code receiving module 310 receives Whether from foreground it is switched to running background with program;
The function call module 330 is configured as going out application by internal memory optimization code detection when state detection module 320 When program is switched to running background from foreground, function is discharged by application call memory, memory release function is for discharging Free memory.
Optionally, when memory release function is in the private function for forbidding editing mode, device further includes:It obtains address Modulus block 340 and address display module 350.
The address acquisition module 340 is configured as obtaining the absolute address of the Public Function of application call, wherein Public Function has the permission for calling memory release function;
The address display module 350, be configured as the absolute address of the Public Function that address acquisition module 340 is obtained into Row display, the absolute address of Public Function are used to indicate the absolute address for calculating memory release function and memory are discharged function Absolute address is added in internal memory optimization code, and the absolute address of memory release function is added equal to the absolute address of Public Function The relative address of the relative address of Public Function and memory release function, Public Function and memory release function is by preset symbol Table provides.
Optionally, address acquisition module 340, including:Command reception submodule 341 and address search submodule 342.
The command reception submodule 341, is configured as receiving and carries program identification and the function identification of Public Function Read instruction in address;
The address search submodule 342, is configured as in dynamic link library, and look-up command receiving submodule 341 indicates Application call Public Function absolute address.
Optionally, function call module 330, including:Address sending submodule 331 and function call submodule 332.
The address sending submodule 331 is configured as that memory is discharged to the absolute address of function by internal memory optimization code It is sent to application program;
The function call submodule 332, the memory for being configured as sending in address sending submodule 331 discharge the exhausted of function To under the instruction of address, discharging function by application call memory.
Optionally, memory release function is in allowing the private function of editing mode publicly-owned into obtaining after edlin Function.
In conclusion the internal memory optimization device that the disclosure provides, program identification and memory release letter are carried by receiving Several internal memory optimization codes, for the program identification for identifying the application program for needing releasing idling memory, which is to answer It is occupied in front stage operation with program and is not required to the memory occupied in running background;Pass through internal memory optimization code detection application journey Whether sequence from foreground is switched to running background;It is transported if going out application program by internal memory optimization code detection and being switched to backstage from foreground Row, then discharge function by application call memory, which discharges function and be used for releasing idling memory, can directly invoke Include the internal memory optimization code of memory release function, the free memory of application program is discharged, is solved in terminal The problem of memory source recycling can just be triggered when depositing deficiency, terminal is caused to be constantly in memory source tense situation, reaches and carried The effect of the processing capacity of high terminal.
In addition, memory release function be in allow the private function of editing mode into the publicly-owned letter obtained after edlin Edited memory release function can directly be added in internal memory optimization code by number, user, and internal memory optimization code can be straight It connects and calls memory release function, the absolute address without discharging function by memory calls memory to discharge function, improves Discharge the efficiency of the free memory of application program.
About the device in above-described embodiment, wherein modules execute the concrete mode of operation in related this method Embodiment in be described in detail, explanation will be not set forth in detail herein.
Fig. 5 is a kind of block diagram of device 500 for internal memory optimization shown according to an exemplary embodiment.For example, dress It can be mobile phone, computer, digital broadcast terminal, messaging devices, game console, tablet device, medical treatment to set 500 Equipment, body-building equipment, personal digital assistant etc..
With reference to Fig. 5, device 500 may include following one or more components:Processing component 502, memory 504, power supply Component 506, multimedia component 508, audio component 510, the interface 512 of input/output (I/O), sensor module 514, and Communication component 516.
The integrated operation of 502 usual control device 500 of processing component, such as with display, call, data communication, phase Machine operates and record operates associated operation.Processing component 502 may include that one or more processors 518 refer to execute It enables, to perform all or part of the steps of the methods described above.In addition, processing component 502 may include one or more modules, just Interaction between processing component 502 and other assemblies.For example, processing component 502 may include multi-media module, it is more to facilitate Interaction between media component 508 and processing component 502.
Memory 504 is configured as storing various types of data to support the operation in device 500.These data are shown Example includes instruction for any application program or method that operate on device 500, contact data, and telephone book data disappears Breath, picture, video etc..Memory 504 can be by any kind of volatibility or non-volatile memory device or their group It closes and realizes, such as static RAM (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash Device, disk or CD.
Power supply module 506 provides electric power for the various assemblies of device 500.Power supply module 506 may include power management system System, one or more power supplys and other generated with for device 500, management and the associated component of distribution electric power.
Multimedia component 508 is included in the screen of one output interface of offer between described device 500 and user.One In a little embodiments, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen Curtain may be implemented as touch screen, to receive input signal from the user.Touch panel includes one or more touch sensings Device is to sense the gesture on touch, slide, and touch panel.The touch sensor can not only sense touch or sliding action Boundary, but also detect duration and pressure associated with the touch or slide operation.In some embodiments, more matchmakers Body component 508 includes a front camera and/or rear camera.When device 500 is in operation mode, such as screening-mode or When video mode, front camera and/or rear camera can receive external multi-medium data.Each front camera and Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio component 510 is configured as output and/or input audio signal.For example, audio component 510 includes a Mike Wind (MIC), when device 500 is in operation mode, when such as call model, logging mode and speech recognition mode, microphone by with It is set to reception external audio signal.The received audio signal can be further stored in memory 504 or via communication set Part 516 is sent.In some embodiments, audio component 510 further includes a loud speaker, is used for exports audio signal.
I/O interfaces 512 provide interface between processing component 502 and peripheral interface module, and above-mentioned peripheral interface module can To be keyboard, click wheel, button etc..These buttons may include but be not limited to:Home button, volume button, start button and lock Determine button.
Sensor module 514 includes one or more sensors, and the state for providing various aspects for device 500 is commented Estimate.For example, sensor module 514 can detect the state that opens/closes of device 500, and the relative positioning of component, for example, it is described Component is the display and keypad of device 500, and sensor module 514 can be with 500 1 components of detection device 500 or device Position change, the existence or non-existence that user contacts with device 500,500 orientation of device or acceleration/deceleration and device 500 Temperature change.Sensor module 514 may include proximity sensor, be configured to detect without any physical contact Presence of nearby objects.Sensor module 514 can also include optical sensor, such as CMOS or ccd image sensor, at As being used in application.In some embodiments, which can also include acceleration transducer, gyro sensors Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 516 is configured to facilitate the communication of wired or wireless way between device 500 and other equipment.Device 500 can access the wireless network based on communication standard, such as WiFi, 2G or 3G or combination thereof.In an exemplary implementation In example, communication component 516 receives broadcast singal or broadcast related information from external broadcasting management system via broadcast channel. In one exemplary embodiment, the communication component 516 further includes near-field communication (NFC) module, to promote short range communication.Example Such as, NFC module can be based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology, Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 500 can be believed by one or more application application-specific integrated circuit (ASIC), number Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, it includes the non-transitorycomputer readable storage medium instructed, example to additionally provide a kind of Such as include the memory 504 of instruction, above-metioned instruction can be executed by the processor 518 of device 500 to complete the above method.For example, The non-transitorycomputer readable storage medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk With optical data storage devices etc..
Those skilled in the art will readily occur to the other of the disclosure after considering specification and putting into practice disclosure herein Embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Adaptive change follow the general principles of this disclosure and include the undocumented common knowledge in the art of the disclosure or Conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by following power Profit requires to point out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the accompanying claims.

Claims (9)

1. a kind of Memory Optimize Method, which is characterized in that including:
The internal memory optimization code for carrying program identification and memory release function is received, described program mark needs to release for identifying The application program of free memory is put, the free memory is that the application program is occupied in front stage operation and in running background It is not required to the memory occupied;
Whether from foreground it is switched to running background by application program described in the internal memory optimization code detection;
If go out the application program by the internal memory optimization code detection is switched to running background from foreground, answered by described The memory described in routine call discharges function, and the memory release function is for discharging the free memory;
Wherein, memory release function be in allow the private function of editing mode into the publicly-owned letter obtained after edlin Number.
2. if according to the method described in claim 1, it is characterized in that, memory release function is to be in forbid editing mode Private function, then the method further include:
Obtain the absolute address of the Public Function of the application call, wherein the Public Function, which has, to be called in described Deposit the permission of release function;
The absolute address of the Public Function is shown, the absolute address of the Public Function, which is used to indicate, to be calculated in described It deposits the absolute address of release function and the absolute address that the memory is discharged to function is added in the internal memory optimization code, institute The absolute address for stating memory release function is equal to the absolute address of the Public Function plus the Public Function and the memory The relative address of function is discharged, the relative address that the Public Function and the memory discharge function is carried by preset symbol table For.
3. according to the method described in claim 2, it is characterized in that, the Public Function for obtaining the application call Absolute address, including:
Read instruction in the address for receiving the function identification for carrying described program mark and the Public Function;
In dynamic link library, the absolute address of the Public Function of the application call is searched.
4. according to the method in claim 2 or 3, which is characterized in that described to pass through memory described in the application call Function is discharged, including:
The absolute address that the memory is discharged to function by the internal memory optimization code is sent to the application program;
Under the instruction for discharging the absolute address of function in the memory, letter is discharged by memory described in the application call Number.
5. a kind of internal memory optimization device, which is characterized in that including:
Code receiving module is configured as receiving the internal memory optimization code for carrying program identification and memory release function, described Program identification is that the application program is transported on foreground for identifying the application program for needing releasing idling memory, the free memory It is occupied when row and is not required to the memory occupied in running background;
State detection module is configured as answering described in the internal memory optimization code detection received by the code receiving module Whether from foreground it is switched to running background with program;
Function call module is configured as going out the application by the internal memory optimization code detection when the state detection module When program is switched to running background from foreground, function, the memory release are discharged by memory described in the application call Function is for discharging the free memory;
Wherein, memory release function be in allow the private function of editing mode into the publicly-owned letter obtained after edlin Number.
6. device according to claim 5, which is characterized in that when memory release function is to be in forbid editing mode Private function when, described device further includes:
Address acquisition module is configured as obtaining the absolute address of the Public Function of the application call, wherein the public affairs There is function that there is the permission for calling the memory release function;
Address display module, the absolute address for being configured as the Public Function obtained to described address acquisition module are shown Show, the absolute address of the Public Function is used to indicate the absolute address for calculating the memory release function and releases the memory The absolute address for putting function is added in the internal memory optimization code, and the absolute address of the memory release function is equal to the public affairs There are relative address of the absolute address plus the Public Function and memory release function of function, the Public Function and institute The relative address for stating memory release function is provided by preset symbol table.
7. device according to claim 6, which is characterized in that described address acquisition module, including:
Command reception submodule is configured as receiving the ground for the function identification for carrying described program mark and the Public Function Read instruction in location;
Address search submodule, is configured as in dynamic link library, searches described the answering of described instruction receiving submodule instruction With the absolute address of the Public Function of routine call.
8. the device described according to claim 6 or 7, which is characterized in that the function call module, including:
Address sending submodule, the absolute address for being configured as discharging the memory by the internal memory optimization code function are sent out Give the application program;
Function call submodule, the memory for being configured as sending in described address sending submodule discharge function utterly Under the instruction of location, function is discharged by memory described in the application call.
9. a kind of internal memory optimization device, which is characterized in that including:
Processor;
Memory for storing processor-executable instruction;
Wherein, the processor is configured as:
The internal memory optimization code for carrying program identification and memory release function is received, described program mark needs to release for identifying The application program of free memory is put, the free memory is that the application program is occupied in front stage operation and in running background It is not required to the memory occupied;
Whether from foreground it is switched to running background by application program described in the internal memory optimization code detection;
If go out the application program by the internal memory optimization code detection is switched to running background from foreground, answered by described The memory described in routine call discharges function, and the memory release function is for discharging the free memory;
Wherein, memory release function be in allow the private function of editing mode into the publicly-owned letter obtained after edlin Number.
CN201410584383.1A 2014-10-27 2014-10-27 Memory Optimize Method and device Active CN104375828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410584383.1A CN104375828B (en) 2014-10-27 2014-10-27 Memory Optimize Method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410584383.1A CN104375828B (en) 2014-10-27 2014-10-27 Memory Optimize Method and device

Publications (2)

Publication Number Publication Date
CN104375828A CN104375828A (en) 2015-02-25
CN104375828B true CN104375828B (en) 2018-07-27

Family

ID=52554771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410584383.1A Active CN104375828B (en) 2014-10-27 2014-10-27 Memory Optimize Method and device

Country Status (1)

Country Link
CN (1) CN104375828B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105159823A (en) * 2015-08-07 2015-12-16 北京元心科技有限公司 Application survival state management method and intelligent terminal
CN105677435A (en) * 2015-12-30 2016-06-15 小米科技有限责任公司 Function invoking method, apparatus and terminal
CN105740078B (en) * 2016-01-29 2020-09-08 华为技术有限公司 Memory management method, device and terminal
CN106021130A (en) * 2016-05-10 2016-10-12 北京小米移动软件有限公司 Memory processing method and device
CN106055406A (en) * 2016-05-20 2016-10-26 深圳天珑无线科技有限公司 Program operation method and terminal
CN107145582B (en) * 2017-05-09 2022-01-04 深圳Tcl新技术有限公司 Control method of database cursor and database system
CN109117263B (en) * 2017-06-23 2023-08-15 中兴通讯股份有限公司 Method and device for releasing memory of user terminal
WO2019028912A1 (en) * 2017-08-11 2019-02-14 华为技术有限公司 Application switching method and device
CN108984219B (en) * 2018-08-29 2021-03-26 迈普通信技术股份有限公司 Memory parameter configuration method and electronic equipment
CN110209434B (en) * 2019-04-23 2022-04-22 努比亚技术有限公司 Memory management method and device and computer readable storage medium
CN111274155B (en) * 2020-02-25 2021-08-06 腾讯科技(深圳)有限公司 Memory operation recording method, device, equipment and storage medium of dynamic library
CN112114965A (en) * 2020-09-15 2020-12-22 深圳市欢太科技有限公司 Application program running method and device, terminal and storage medium
CN112685371A (en) * 2020-12-30 2021-04-20 江苏达科信息科技有限公司 File storage space distribution method and device based on big data and storage medium
CN116244067B (en) * 2021-06-10 2024-05-03 荣耀终端有限公司 Virtual memory management method and electronic equipment
CN115525404B (en) * 2022-02-22 2023-09-19 荣耀终端有限公司 Method, device and storage medium for releasing memory

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164268A (en) * 2013-04-02 2013-06-19 北京奇虎科技有限公司 System optimization method and system optimization device
CN103324500A (en) * 2013-05-06 2013-09-25 广州市动景计算机科技有限公司 Method and device for recycling internal memory

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7478326B2 (en) * 2005-01-18 2009-01-13 Microsoft Corporation Window information switching system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164268A (en) * 2013-04-02 2013-06-19 北京奇虎科技有限公司 System optimization method and system optimization device
CN103324500A (en) * 2013-05-06 2013-09-25 广州市动景计算机科技有限公司 Method and device for recycling internal memory

Also Published As

Publication number Publication date
CN104375828A (en) 2015-02-25

Similar Documents

Publication Publication Date Title
CN104375828B (en) Memory Optimize Method and device
CN105338177B (en) message delay broadcasting method and device
CN104951335B (en) The processing method and processing device of application program installation kit
CN107145800A (en) Method for protecting privacy and device, terminal and storage medium
CN104503740A (en) Memory management method and device
CN105653323A (en) Application program management method and device
CN106034170B (en) Group's generation method and device
CN104837154B (en) The control method and device of wireless access points
CN106970769A (en) Multi-screen display method and device
CN104793969A (en) Application program unloading method and device
CN105205153B (en) File memory method and device
CN105653903B (en) The management method and device of application program permission
CN104298576B (en) terminal test method and device
CN105868624A (en) Application program authority management method and device
CN106201250A (en) Account changing method and device
CN105955817A (en) Service process control method and device
CN109446796A (en) Application control method and device, mobile terminal and storage medium
CN108446178A (en) Optimize the method and device of interim card
CN105957011B (en) Image processing method and device
CN105682187B (en) Icon display method and device
CN105072245B (en) Network service provider method and device
CN106357504A (en) User list cleaning method and device thereof
CN106383856A (en) Method and device for managing file system quota
CN105677435A (en) Function invoking method, apparatus and terminal
JP2021531519A (en) Touch signal processing methods, devices and media

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant