CN104375828A - Method and device for optimizing memory - Google Patents

Method and device for optimizing memory Download PDF

Info

Publication number
CN104375828A
CN104375828A CN201410584383.1A CN201410584383A CN104375828A CN 104375828 A CN104375828 A CN 104375828A CN 201410584383 A CN201410584383 A CN 201410584383A CN 104375828 A CN104375828 A CN 104375828A
Authority
CN
China
Prior art keywords
internal memory
function
release function
application program
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.)
Granted
Application number
CN201410584383.1A
Other languages
Chinese (zh)
Other versions
CN104375828B (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.)
Beijing Xiaomi Technology Co Ltd
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 invention relates to a method and device for optimizing a memory, and belongs to the technical field of computers. The method includes the steps that a memory optimized code which carries a program identification and a memory freeing function is received, the program identification is used for identifying an application program with a free memory needing to be freed, and the free memory is occupied when the application program operates at a front stage and does not need to be occupied when the application program operates at a backstage; the memory optimized code is used for detecting whether the application program is switched to the backstage to operate from the front stage; if it is detected that the application program is switched to the backstage to operate from the front stage through the memory optimized code, the application program is informed to call the memory freeing function, and the memory freeing function is used for freeing the free memory. The device comprises a code receiving module, a state detecting module and a function calling module. The method and device for optimizing the memory solve the problem that memory resource recovery can only be triggered when a memory of a terminal is insufficient, so that the terminal is in a memory resource tension state all the time, and therefore the effect of improving the processing capacity of the terminal is achieved.

Description

Memory Optimize Method and device
Technical field
The disclosure relates to field of computer technology, particularly a kind of Memory Optimize Method and device.
Background technology
Memory source shared by the application program run by Virtual Machine Manager in JAVA.Foreground is operated in during application program launching, carry out initialization and can take a large amount of internal memory, enter stable operation after date and forward running background to, now do not need to take a large amount of internal memory, and the internal memory of free time is still employed program takies, virtual machine processes through for a long time just can be recovered these internal memories.Therefore, when memory source deficiency, need the memory source of free time to reclaim fast.
When carrying out memory source and reclaiming fast, the application program of terminal to all operations detects, if detect, the memory source value that the application program of all operations takies is greater than first threshold, then each application program run in system is detected respectively, when the memory source value existed if detect shared by some application programs is greater than Second Threshold, stop the operation of this application program, reclaim the internal memory shared by this application program.
Open people is realizing in process of the present disclosure, finds at least there is following defect in correlation technique: just can trigger memory source when tag memory is not enough and reclaim, cause terminal to be in memory source tense situation always, reduce the processing power of terminal.
Summary of the invention
Just can trigger memory source recovery for solving when tag memory is not enough, causing terminal to be in the problem of memory source tense situation always, present disclose provides a kind of Memory Optimize Method and device.
According to the first aspect of disclosure embodiment, a kind of Memory Optimize Method is provided, comprises:
Receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
Whether running background is switched to from foreground by application program described in described internal memory optimization code detection;
If go out described application program by described internal memory optimization code detection to be switched to running background from foreground, then by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
Optionally, if described internal memory release function is in the privately owned function forbidding editing mode, then described method also comprises:
Obtain the specific address of the Public Function of described application call, wherein, described Public Function has the authority calling described internal memory release function;
The specific address of described Public Function is shown, the specific address of described Public Function is used to indicate the specific address of calculating described internal memory release function and adds in described internal memory optimization code by the specific address of described internal memory release function, the specific address that the specific address of described internal memory release function equals described Public Function adds the relative address of described Public Function and described internal memory release function, and the relative address of described Public Function and described internal memory release function is provided by the symbol table preset.
Optionally, the specific address of the Public Function of the described application call of described acquisition, comprising:
Receive the address reading command carrying the function identification of described program identification and described Public Function;
In dynamic link library, search the specific address of the described Public Function of described application call.
Optionally, described by internal memory release function described in described application call, comprising:
By described internal memory optimization code, the specific address of described internal memory release function is sent to described application program;
Under the instruction of the specific address of described internal memory release function, by internal memory release function described in described application call.
Optionally, described internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.
According to the second aspect of disclosure embodiment, a kind of internal memory optimization device is provided, comprises:
Code receiver module, be configured to receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
State detection module, is configured to application program described in the described internal memory optimization code detection by described code receiver module reception and whether is switched to running background from foreground;
Function call module, be configured to when described state detection module by described internal memory optimization code detection go out described application program be switched to running background from foreground time, by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
Optionally, when described internal memory release function is when being in the privately owned function forbidding editing mode, described device also comprises:
Address acquisition module, is configured to the specific address of the Public Function obtaining described application call, and wherein, described Public Function has the authority calling described internal memory release function;
Address display module, be configured to show the specific address of the described Public Function that described address acquisition module obtains, the specific address of described Public Function is used to indicate the specific address of calculating described internal memory release function and adds in described internal memory optimization code by the specific address of described internal memory release function, the specific address that the specific address of described internal memory release function equals described Public Function adds the relative address of described Public Function and described internal memory release function, the relative address of described Public Function and described internal memory release function is provided by the symbol table preset.
Optionally, described address acquisition module, comprising:
Command reception submodule, is configured to receive the address reading command of the function identification carrying described program identification and described Public Function;
Address search submodule, is configured in dynamic link library, searches the specific address of the described Public Function of the described application call of described command reception submodule instruction.
Optionally, described function call module, comprising:
Address sends submodule, is configured to, by described internal memory optimization code, the specific address of described internal memory release function is sent to described application program;
Function call submodule, is configured under described address sends the instruction of the specific address of the described internal memory release function that submodule sends, by internal memory release function described in described application call.
Optionally, described internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.
According to the third aspect of disclosure embodiment, a kind of internal memory optimization device is provided, comprises:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
Whether running background is switched to from foreground by application program described in described internal memory optimization code detection;
If go out described application program by described internal memory optimization code detection to be switched to running background from foreground, then by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
The technical scheme that embodiment of the present disclosure provides can comprise following beneficial effect:
By receiving the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background; Whether running background is switched to from foreground by internal memory optimization code detection application program; If go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory, directly can call the internal memory optimization code including internal memory release function, the free memory of application programs discharges, solve and just can trigger memory source recovery when tag memory is not enough, cause terminal to be in the problem of memory source tense situation always, reach the effect of the processing power improving terminal.
Should be understood that, it is only exemplary that above general description and details hereinafter describe, and can not limit the disclosure.
Accompanying drawing explanation
Accompanying drawing to be herein merged in instructions and to form a part for present disclosure specification, shows and meets embodiment of the present disclosure, and is used from instructions one and explains principle of the present disclosure.
Fig. 1 is the process flow diagram of a kind of Memory Optimize Method according to an exemplary embodiment.
Fig. 2 is the process flow diagram of a kind of Memory Optimize Method according to another exemplary embodiment.
Fig. 3 is the block diagram of a kind of internal memory optimization device according to an exemplary embodiment.
Fig. 4 is the block diagram of a kind of internal memory optimization device according to an exemplary embodiment.
Fig. 5 is the block diagram of a kind of device for internal memory optimization according to an exemplary embodiment.
Embodiment
Here will be described exemplary embodiment in detail, its sample table shows in the accompanying drawings.When description below relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawing represents same or analogous key element.Embodiment described in following exemplary embodiment does not represent all embodiments consistent with the disclosure.On the contrary, they only with as in appended claims describe in detail, the example of apparatus and method that aspects more of the present disclosure are consistent.
Fig. 1 is the process flow diagram of a kind of Memory Optimize Method according to an exemplary embodiment, and this Memory Optimize Method is applied in terminal, and as shown in Figure 1, this Memory Optimize Method comprises the following steps.
In a step 101, receive the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background.
Internal memory release function is the function having the free memory of determining that application program takies and discharge the function of this free memory.
In a step 102, whether running background is switched to from foreground by internal memory optimization code detection application program.
Operate in foreground during application program launching, carry out initialization and can take a large amount of internal memory, enter stable operation after date and forward running background to, now do not need to take a large amount of internal memory, and free memory is still employed program takies, now, releasing idling internal memory can be carried out by internal memory optimization code.
Before the free memory using internal memory optimization code release application program, terminal needs to detect application program and whether is switched to running background from foreground, thus determines whether application program exists free memory.
In step 103, if go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory.
In sum, the Memory Optimize Method that the disclosure provides, by receiving the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background; Whether running background is switched to from foreground by internal memory optimization code detection application program; If go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory, directly can call the internal memory optimization code including internal memory release function, the free memory of application programs discharges, solve and just can trigger memory source recovery when tag memory is not enough, cause terminal to be in the problem of memory source tense situation always, reach the effect of the processing power improving terminal.
Fig. 2 is the process flow diagram of a kind of Memory Optimize Method according to another exemplary embodiment, and this Memory Optimize Method is applied in terminal, and as shown in Figure 2, this Memory Optimize Method comprises the steps.
In step 201, if internal memory release function is in the privately owned function forbidding editing mode, then obtain the specific address of the Public Function of application call, wherein, this Public Function has the authority of invoke memory release function; The specific address of Public Function is shown, the specific address of this Public Function is used to indicate the specific address that calculates internal memory release function and specific address internal memory being discharged function is added in internal memory optimization code, the specific address that the specific address of this internal memory release function equals Public Function adds the relative address of Public Function and internal memory release function, and the relative address of this Public Function and internal memory release function is provided by the symbol table preset.
Internal memory release function is privately owned function in virtual machine source code, be the function having the free memory of determining that application program takies and discharge the function of this free memory, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background.Public Function is the function of the authority with invoke memory release function, and specific address is that after function is loaded into application program, system is the memory address that this function distributes.
When application program is run on a virtual machine, the free memory discharged shared by function application programs by virtual machine call internal memory discharges, because virtual machine needs could reclaim internal memory through process for a long time, therefore, the internal memory release function that terminal can directly be called in virtual machine carrys out releasing idling internal memory.If internal memory release function is in the privately owned function forbidding editing mode, that is, internal memory release function is not editable source code, now, in order to call this internal memory release function, terminal needs to obtain the specific address of this internal memory release function when application program is run.
The relative address discharging function due to Public Function and internal memory is fixing, therefore, can be obtained the specific address of internal memory release function by the specific address obtaining Public Function.Therefore, terminal needs the specific address of acquisition Public Function and Public Function and internal memory to discharge the relative address of function.
Wherein, obtain the specific address of the Public Function of application call, comprising:
1) the address reading command carrying the function identification of program identification and Public Function is received;
2) in dynamic link library, the specific address of the Public Function of application call is searched.
When Public Function is employed routine call, system can be this Public Function storage allocation address, and the specific address that this memory address is defined as this Public Function is stored in dynamic link library by terminal.When needing the specific address obtaining this Public Function, terminal directly can read this specific address from dynamic link library.
Due to Public Function by different application calls time, system can distribute different memory addresss for this Public Function, therefore, when obtaining the Public Function of some application calls, also needs the program identification obtaining this application program.That is, need the function identification carrying program identification and Public Function in the address reading command that terminal receives, terminal is identified in dynamic link library the specific address of searching this Public Function according to program identification sum functions, and shows this specific address.
It should be noted that, before adding function identification to address acquisition instruction, user can by checking the call function of the free memory that virtual machine source code finds release virtual machine to take, again by checking that the header file of virtual machine determines the Public Function with the authority of invoke memory release function in this call function, the function identification of this Public Function is added in address acquisition instruction.
When obtaining the relative address of Public Function and privately owned function, because the relative address of Public Function and internal memory release function is provided by the symbol table preset, therefore, user by checking this symbol table, can read the relative address needing this Public Function and privately owned function.Wherein, this symbol table preset is obtained through objdump by symbol storehouse.
Determining after the specific address of Public Function and Public Function and internal memory discharge the relative address of function, the specific address that the specific address of this internal memory release function can be confirmed as Public Function adds the relative address of Public Function and internal memory release function.Therefore, the specific address of the Public Function of terminal demonstration is got user, and, read the relative address of Public Function and privately owned function from symbol table after, the specific address of Public Function can be added relative address by user, obtains the specific address of privately owned function.
In step 202., receive the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background.
After the specific address determining internal memory release function, the program identification of specific address and application program that user can discharge function according to internal memory writes internal memory optimization code, this internal memory optimization code is sent to terminal, after terminal receives this internal memory optimization code, carry out internal memory optimization according to this internal memory optimization code.
In step 203, whether running background is switched to from foreground by internal memory optimization code detection application program.
Operate in foreground during application program launching, carry out initialization and can take a large amount of internal memory, enter stable operation after date and forward running background to, now do not need to take a large amount of internal memory, and the internal memory of free time is still employed program takies, now, releasing idling internal memory can be carried out by internal memory optimization code.
Before the free memory using internal memory optimization code release application program, terminal needs to detect application program and whether is switched to running background from foreground, thus determines whether application program exists free memory.When detecting application program and whether being switched to running background from foreground, can by the current state of internal memory optimization Code obtaining application program, if the current state of application program is for hanging up, then determine that application program is at running background, if the current state of application program for running, then determines that application program operates in foreground.
In step 204, if go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory.
If terminal goes out application program by internal memory optimization code detection be switched to running background from foreground, then determine that this application program exists free memory, the free memory that terminal is taken by application call internal memory release function release application program.
Wherein, by application call internal memory release function, comprising:
1) specific address internal memory being discharged function by internal memory optimization code sends to application program;
2) under the instruction of the specific address of internal memory release function, by application call internal memory release function.
Terminal operating internal memory optimization code, the instruction of the specific address carrying this internal memory release function is sent to application program, invoke memory release function under the specific address instruction making application program can discharge function at internal memory, thus the free memory of release shared by application program.
In another embodiment, terminal does not perform step 201, and namely terminal performs step 202-204, and now, internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.That is, internal memory release function is editable Open Source Code, then user can discharge function to internal memory and edits, internal memory is discharged function becomes can directly by the Public Function of application call, now, it is Public Function that internal memory discharges function.
The Public Function obtained after this editor and program identification corresponding to application program can add in internal memory optimization code by user, after terminal enters backstage by internal memory optimization code detection to application program, terminal operating internal memory optimization code, internal memory is discharged function and sends to application program, make application program direct invoke memory release function, the free memory of release shared by application program, and do not need the specific address invoke memory release function by internal memory release function, improve the efficiency of the free memory of release application program.
In sum, the Memory Optimize Method that the disclosure provides, by receiving the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background; Whether running background is switched to from foreground by internal memory optimization code detection application program; If go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory, directly can call the internal memory optimization code including internal memory release function, the free memory of application programs discharges, solve and just can trigger memory source recovery when tag memory is not enough, cause terminal to be in the problem of memory source tense situation always, reach the effect of the processing power improving terminal.
In addition, internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode, internal memory release function after editor can directly add in internal memory optimization code by user, internal memory optimization code directly can discharge function by invoke memory, and do not need the specific address invoke memory release function by internal memory release function, improve the efficiency of the free memory of release application program.
Fig. 3 is the block diagram of a kind of internal memory optimization device according to an exemplary embodiment, this internal memory optimization application of installation is in terminal, as shown in Figure 3, this internal memory optimization device comprises: code receiver module 310, state detection module 320 sum functions calling module 330.
This code receiver module 310, be configured to receive the internal memory optimization code carrying program identification and internal memory release function, program identification needs the application program of releasing idling internal memory for identifying, free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background;
This state detection module 320, whether the internal memory optimization code detection application program being configured to be received by code receiver module 310 is switched to running background from foreground;
This function call module 330, be configured to when state detection module 320 by internal memory optimization code detection go out application program be switched to running background from foreground time, by application call internal memory release function, internal memory release function be used for releasing idling internal memory.
In sum, the internal memory optimization device that the disclosure provides, by receiving the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background; Whether running background is switched to from foreground by internal memory optimization code detection application program; If go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory, directly can call the internal memory optimization code including internal memory release function, the free memory of application programs discharges, solve and just can trigger memory source recovery when tag memory is not enough, cause terminal to be in the problem of memory source tense situation always, reach the effect of the processing power improving terminal.
Fig. 4 is the block diagram of a kind of internal memory optimization device according to an exemplary embodiment, this internal memory optimization application of installation is in terminal, as shown in Figure 4, this internal memory optimization device comprises: code receiver module 310, state detection module 320 sum functions calling module 330.
This code receiver module 310, be configured to receive the internal memory optimization code carrying program identification and internal memory release function, program identification needs the application program of releasing idling internal memory for identifying, free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background;
This state detection module 320, whether the internal memory optimization code detection application program being configured to be received by code receiver module 310 is switched to running background from foreground;
This function call module 330, be configured to when state detection module 320 by internal memory optimization code detection go out application program be switched to running background from foreground time, by application call internal memory release function, internal memory release function be used for releasing idling internal memory.
Optionally, when internal memory release function is that when being in the privately owned function forbidding editing mode, device also comprises: address acquisition module 340 and address display module 350.
This address acquisition module 340, is configured to the specific address of the Public Function obtaining application call, and wherein, Public Function has the authority of invoke memory release function;
This address display module 350, be configured to show the specific address of the Public Function that address acquisition module 340 obtains, the specific address of Public Function is used to indicate the specific address that calculates internal memory release function and specific address internal memory being discharged function is added in internal memory optimization code, the specific address that the specific address of internal memory release function equals Public Function adds the relative address of Public Function and internal memory release function, and the relative address of Public Function and internal memory release function is provided by the symbol table preset.
Optionally, address acquisition module 340, comprising: command reception submodule 341 and address search submodule 342.
This command reception submodule 341, is configured to receive the address reading command of the function identification carrying program identification and Public Function;
This address search submodule 342, is configured in dynamic link library, and look-up command receives the specific address of the Public Function of the application call that submodule 341 indicates.
Optionally, function call module 330, comprising: address sends submodule 331 sum functions and calls submodule 332.
This address sends submodule 331, and the specific address being configured to be discharged by internal memory by internal memory optimization code function sends to application program;
This function call submodule 332, is configured under address sends the instruction of the specific address of the internal memory release function that submodule 331 sends, by application call internal memory release function.
Optionally, internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.
In sum, the internal memory optimization device that the disclosure provides, by receiving the internal memory optimization code carrying program identification and internal memory release function, this program identification needs the application program of releasing idling internal memory for identifying, this free memory is that application program takies when front stage operation and do not need the internal memory that takies when running background; Whether running background is switched to from foreground by internal memory optimization code detection application program; If go out application program by internal memory optimization code detection to be switched to running background from foreground, then by application call internal memory release function, this internal memory release function is used for releasing idling internal memory, directly can call the internal memory optimization code including internal memory release function, the free memory of application programs discharges, solve and just can trigger memory source recovery when tag memory is not enough, cause terminal to be in the problem of memory source tense situation always, reach the effect of the processing power improving terminal.
In addition, internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode, internal memory release function after editor can directly add in internal memory optimization code by user, internal memory optimization code directly can discharge function by invoke memory, and do not need the specific address invoke memory release function by internal memory release function, improve the efficiency of the free memory of release application program.
About the device in above-described embodiment, wherein the concrete mode of modules executable operations has been described in detail in about the embodiment of the method, will not elaborate explanation herein.
Fig. 5 is the block diagram of a kind of device 500 for internal memory optimization according to an exemplary embodiment.Such as, device 500 can be mobile phone, computing machine, digital broadcast terminal, messaging devices, game console, tablet device, Medical Devices, body-building equipment, personal digital assistant etc.
With reference to Fig. 5, device 500 can comprise following one or more assembly: processing components 502, storer 504, power supply module 506, multimedia groupware 508, audio-frequency assembly 510, the interface 512 of I/O (I/O), sensor module 514, and communications component 516.
The integrated operation of the usual control device 500 of processing components 502, such as with display, call, data communication, camera operation and record operate the operation be associated.Processing components 502 can comprise one or more processor 518 to perform instruction, to complete all or part of step of above-mentioned method.In addition, processing components 502 can comprise one or more module, and what be convenient between processing components 502 and other assemblies is mutual.Such as, processing components 502 can comprise multi-media module, mutual with what facilitate between multimedia groupware 508 and processing components 502.
Storer 504 is configured to store various types of data to be supported in the operation of device 500.The example of these data comprises the instruction of any application program for operating on device 500 or method, contact data, telephone book data, message, picture, video etc.Storer 504 can be realized by the volatibility of any type or non-volatile memory device or their combination, as static RAM (SRAM), Electrically Erasable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory EPROM (EPROM), programmable read only memory (PROM), ROM (read-only memory) (ROM), magnetic store, flash memory, disk or CD.
The various assemblies that power supply module 506 is device 500 provide electric power.Power supply module 506 can comprise power-supply management system, one or more power supply, and other and the assembly generating, manage and distribute electric power for device 500 and be associated.
Multimedia groupware 508 is included in the screen providing an output interface between described device 500 and user.In certain embodiments, screen can comprise liquid crystal display (LCD) and touch panel (TP).If screen comprises touch panel, screen may be implemented as touch-screen, to receive the input signal from user.Touch panel comprises one or more touch sensor with the gesture on sensing touch, slip and touch panel.Described touch sensor can the border of not only sensing touch or sliding action, but also detects the duration relevant to described touch or slide and pressure.In certain embodiments, multimedia groupware 508 comprises a front-facing camera and/or post-positioned pick-up head.When device 500 is in operator scheme, during as screening-mode or video mode, front-facing camera and/or post-positioned pick-up head can receive outside multi-medium data.Each front-facing camera and post-positioned pick-up head can be fixing optical lens systems or have focal length and optical zoom ability.
Audio-frequency assembly 510 is configured to export and/or input audio signal.Such as, audio-frequency assembly 510 comprises a microphone (MIC), and when device 500 is in operator scheme, during as call model, logging mode and speech recognition mode, microphone is configured to receive external audio signal.The sound signal received can be stored in storer 504 further or be sent via communications component 516.In certain embodiments, audio-frequency assembly 510 also comprises a loudspeaker, for output audio signal.
I/O interface 512 is for providing interface between processing components 502 and peripheral interface module, and above-mentioned peripheral interface module can be keyboard, some striking wheel, button etc.These buttons can include but not limited to: home button, volume button, start button and locking press button.
Sensor module 514 comprises one or more sensor, for providing the state estimation of various aspects for device 500.Such as, sensor module 514 can detect the opening/closing state of device 500, the relative positioning of assembly, such as described assembly is display and the keypad of device 500, the position of all right pick-up unit 500 of sensor module 514 or device 500 1 assemblies changes, the presence or absence that user contacts with device 500, the temperature variation of device 500 orientation or acceleration/deceleration and device 500.Sensor module 514 can comprise proximity transducer, be configured to without any physical contact time detect near the existence of object.Sensor module 514 can also comprise optical sensor, as CMOS or ccd image sensor, for using in imaging applications.In certain embodiments, this sensor module 514 can also comprise acceleration transducer, gyro sensor, Magnetic Sensor, pressure transducer or temperature sensor.
Communications component 516 is configured to the communication being convenient to wired or wireless mode between device 500 and other equipment.Device 500 can access the wireless network based on communication standard, as WiFi, 2G or 3G, or their combination.In one exemplary embodiment, communications component 516 receives from the broadcast singal of external broadcasting management system or broadcast related information via broadcast channel.In one exemplary embodiment, described communications component 516 also comprises near-field communication (NFC) module, to promote junction service.Such as, can based on radio-frequency (RF) identification (RFID) technology in NFC module, Infrared Data Association (IrDA) technology, ultra broadband (UWB) technology, bluetooth (BT) technology and other technologies realize.
In the exemplary embodiment, device 500 can be realized, for performing said method by one or more application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD) (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components.
In the exemplary embodiment, additionally provide a kind of non-transitory computer-readable recording medium comprising instruction, such as, comprise the storer 504 of instruction, above-mentioned instruction can perform said method by the processor 518 of device 500.Such as, described non-transitory computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage devices etc.
Those skilled in the art, at consideration instructions and after putting into practice disclosure herein, will easily expect other embodiment of the present disclosure.The application is intended to contain any modification of the present disclosure, purposes or adaptations, and these modification, purposes or adaptations are followed general principle of the present disclosure and comprised the undocumented common practise in the art of the disclosure or conventional techniques means.Instructions and embodiment are only regarded as exemplary, and true scope of the present disclosure and spirit are pointed out by claim below.
Should be understood that, the disclosure is not limited to precision architecture described above and illustrated in the accompanying drawings, and can carry out various amendment and change not departing from its scope.The scope of the present disclosure is only limited by appended claim.

Claims (11)

1. a Memory Optimize Method, is characterized in that, comprising:
Receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
Whether running background is switched to from foreground by application program described in described internal memory optimization code detection;
If go out described application program by described internal memory optimization code detection to be switched to running background from foreground, then by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
2. method according to claim 1, is characterized in that, if described internal memory release function is in the privately owned function forbidding editing mode, then described method also comprises:
Obtain the specific address of the Public Function of described application call, wherein, described Public Function has the authority calling described internal memory release function;
The specific address of described Public Function is shown, the specific address of described Public Function is used to indicate the specific address of calculating described internal memory release function and adds in described internal memory optimization code by the specific address of described internal memory release function, the specific address that the specific address of described internal memory release function equals described Public Function adds the relative address of described Public Function and described internal memory release function, and the relative address of described Public Function and described internal memory release function is provided by the symbol table preset.
3. method according to claim 2, is characterized in that, the specific address of the Public Function of the described application call of described acquisition, comprising:
Receive the address reading command carrying the function identification of described program identification and described Public Function;
In dynamic link library, search the specific address of the described Public Function of described application call.
4. according to the method in claim 2 or 3, it is characterized in that, described by internal memory release function described in described application call, comprising:
By described internal memory optimization code, the specific address of described internal memory release function is sent to described application program;
Under the instruction of the specific address of described internal memory release function, by internal memory release function described in described application call.
5. method according to claim 1, is characterized in that, described internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.
6. an internal memory optimization device, is characterized in that, comprising:
Code receiver module, be configured to receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
State detection module, is configured to application program described in the described internal memory optimization code detection by described code receiver module reception and whether is switched to running background from foreground;
Function call module, be configured to when described state detection module by described internal memory optimization code detection go out described application program be switched to running background from foreground time, by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
7. device according to claim 6, is characterized in that, when described internal memory release function is when being in the privately owned function forbidding editing mode, described device also comprises:
Address acquisition module, is configured to the specific address of the Public Function obtaining described application call, and wherein, described Public Function has the authority calling described internal memory release function;
Address display module, be configured to show the specific address of the described Public Function that described address acquisition module obtains, the specific address of described Public Function is used to indicate the specific address of calculating described internal memory release function and adds in described internal memory optimization code by the specific address of described internal memory release function, the specific address that the specific address of described internal memory release function equals described Public Function adds the relative address of described Public Function and described internal memory release function, the relative address of described Public Function and described internal memory release function is provided by the symbol table preset.
8. device according to claim 7, is characterized in that, described address acquisition module, comprising:
Command reception submodule, is configured to receive the address reading command of the function identification carrying described program identification and described Public Function;
Address search submodule, is configured in dynamic link library, searches the specific address of the described Public Function of the described application call of described command reception submodule instruction.
9. the device according to claim 7 or 8, is characterized in that, described function call module, comprising:
Address sends submodule, is configured to, by described internal memory optimization code, the specific address of described internal memory release function is sent to described application program;
Function call submodule, is configured under described address sends the instruction of the specific address of the described internal memory release function that submodule sends, by internal memory release function described in described application call.
10. device according to claim 6, is characterized in that, described internal memory release function is the Public Function obtained after editing the privately owned function being in permission editing mode.
11. 1 kinds of internal memory optimization devices, is characterized in that, comprising:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Receive the internal memory optimization code carrying program identification and internal memory release function, described program identification needs the application program of releasing idling internal memory for identifying, described free memory is that described application program takies when front stage operation and do not need the internal memory that takies when running background;
Whether running background is switched to from foreground by application program described in described internal memory optimization code detection;
If go out described application program by described internal memory optimization code detection to be switched to running background from foreground, then by internal memory release function described in described application call, described internal memory release function is for discharging described free memory.
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 true CN104375828A (en) 2015-02-25
CN104375828B 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)

Cited By (16)

* 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
CN105740078A (en) * 2016-01-29 2016-07-06 华为技术有限公司 Memory management method and apparatus, 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
CN107145582A (en) * 2017-05-09 2017-09-08 深圳Tcl新技术有限公司 The control method and Database Systems of database cursor
CN108984219A (en) * 2018-08-29 2018-12-11 迈普通信技术股份有限公司 Memory parameter configuration method and electronic equipment
CN109117263A (en) * 2017-06-23 2019-01-01 中兴通讯股份有限公司 A kind of method and device of user terminal memory release
WO2019028912A1 (en) * 2017-08-11 2019-02-14 华为技术有限公司 Application switching method and device
CN110209434A (en) * 2019-04-23 2019-09-06 努比亚技术有限公司 A kind of EMS memory management process, device and computer readable storage medium
CN111274155A (en) * 2020-02-25 2020-06-12 腾讯科技(深圳)有限公司 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
CN113392037A (en) * 2020-03-12 2021-09-14 深圳市万普拉斯科技有限公司 Memory recovery method and device, computer equipment and storage medium
WO2022257748A1 (en) * 2021-06-10 2022-12-15 荣耀终端有限公司 Virtual memory management method and electronic device
CN115525404A (en) * 2022-02-22 2022-12-27 荣耀终端有限公司 Method, device and storage medium for releasing memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060161847A1 (en) * 2005-01-18 2006-07-20 Microsoft Corporation Window information switching system
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060161847A1 (en) * 2005-01-18 2006-07-20 Microsoft Corporation Window information switching system
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

Cited By (23)

* 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
CN105740078A (en) * 2016-01-29 2016-07-06 华为技术有限公司 Memory management method and apparatus, 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
CN107145582A (en) * 2017-05-09 2017-09-08 深圳Tcl新技术有限公司 The control method and Database Systems of database cursor
CN107145582B (en) * 2017-05-09 2022-01-04 深圳Tcl新技术有限公司 Control method of database cursor and database system
CN109117263A (en) * 2017-06-23 2019-01-01 中兴通讯股份有限公司 A kind of method and device of user terminal memory release
CN109117263B (en) * 2017-06-23 2023-08-15 中兴通讯股份有限公司 Method and device for releasing memory of user terminal
CN109891390A (en) * 2017-08-11 2019-06-14 华为技术有限公司 A kind of application switching method and device
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
CN108984219A (en) * 2018-08-29 2018-12-11 迈普通信技术股份有限公司 Memory parameter configuration method and electronic equipment
CN110209434A (en) * 2019-04-23 2019-09-06 努比亚技术有限公司 A kind of EMS memory management process, device and computer readable storage medium
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
CN111274155A (en) * 2020-02-25 2020-06-12 腾讯科技(深圳)有限公司 Memory operation recording method, device, equipment and storage medium of dynamic library
CN113392037A (en) * 2020-03-12 2021-09-14 深圳市万普拉斯科技有限公司 Memory recovery method and device, computer equipment and storage medium
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
WO2022257748A1 (en) * 2021-06-10 2022-12-15 荣耀终端有限公司 Virtual memory management method and electronic device
CN115525404A (en) * 2022-02-22 2022-12-27 荣耀终端有限公司 Method, device and storage medium for releasing memory
CN115525404B (en) * 2022-02-22 2023-09-19 荣耀终端有限公司 Method, device and storage medium for releasing memory

Also Published As

Publication number Publication date
CN104375828B (en) 2018-07-27

Similar Documents

Publication Publication Date Title
CN104375828A (en) Method and device for optimizing memory
CN104503740A (en) Memory management method and device
CN105677460A (en) Application processing method and apparatus
CN104991789A (en) Method and apparatus for starting application
CN104239094A (en) Method and device for controlling background application programs and terminal equipment
CN104298547A (en) Terminal setting method and device
CN104484200A (en) Method and device for updating firmware
CN105488112A (en) Information pushing method and device
CN103873684B (en) The application process of flashlight and device
CN104391632A (en) Method and device for cleaning memory
CN103914337B (en) Service calling method, device and terminal
CN104766005A (en) Management method and device for application software access authority
CN104968007A (en) Test method and device of intelligent device
CN104951335A (en) Processing method and device for application program installation packages
CN104899610A (en) Picture classification method and device
CN104837154A (en) Wireless access point control method and device
CN104536783A (en) Method and device for setting reserved space
CN105354017A (en) Information processing method and apparatus
CN105094904A (en) Application program installation method and device
CN105430715A (en) Method and apparatus for controlling WIFI scanning
CN104407924A (en) Method and device for optimizing internal memory
CN104714826A (en) Application theme loading method and device
CN105183571A (en) Function calling method and device
CN105515923A (en) Equipment control method and device
CN105187671A (en) Recording method and device

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