WO2014019358A1 - 一种混合内存分配的方法、系统及浏览器 - Google Patents

一种混合内存分配的方法、系统及浏览器 Download PDF

Info

Publication number
WO2014019358A1
WO2014019358A1 PCT/CN2013/071798 CN2013071798W WO2014019358A1 WO 2014019358 A1 WO2014019358 A1 WO 2014019358A1 CN 2013071798 W CN2013071798 W CN 2013071798W WO 2014019358 A1 WO2014019358 A1 WO 2014019358A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
browser
requested
exclusive
maximum
Prior art date
Application number
PCT/CN2013/071798
Other languages
English (en)
French (fr)
Inventor
张敏锐
Original Assignee
深圳市同洲电子股份有限公司
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 深圳市同洲电子股份有限公司 filed Critical 深圳市同洲电子股份有限公司
Publication of WO2014019358A1 publication Critical patent/WO2014019358A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing

Definitions

  • the invention relates to a method, a system and a browser for submitting a memory allocation method.
  • the application is submitted to the Chinese Patent Office on July 28, 2012, and the application number is 201210263567.9.
  • the invention name is "a method, system and browser for mixed memory allocation”. The priority of the Chinese patent application, the entire contents of which is incorporated herein by reference.
  • the present invention relates to the field of memory allocation, and in particular, to a method, system and browser for hybrid memory allocation. Background technique
  • a browser is a piece of software that can display the contents of an HTML file of a web server or file system and let users interact with these files.
  • a browser needs to occupy a certain amount of memory to be able to run normally, but in some actual projects, such as embedded projects, the memory is relatively tight, and it is impossible to provide exclusive memory for the browser. Summary of the invention
  • the embodiment of the invention provides a method, a system and a browser for mixing memory allocation, and uses a mixed memory allocation mechanism to improve memory usage.
  • the present invention is implemented as such, a method of hybrid memory allocation, comprising:
  • the memory requested by the browser is released, and other modules are reused.
  • the method further includes:
  • the browser allocates memory from the exclusive memory. The memory requested by the browser;
  • the memory requested by the browser is released, and the browser exclusively reserves the memory released by the memory.
  • the configuration browser monopolizes the memory, configures a threshold for using the browser memory, and further includes: configuring a maximum memory that the browser can use, and the maximum memory that the browser can use is a maximum system memory requested by the browser. The sum of the exclusive memory with the browser.
  • the memory requested by the browser is allocated from the non-browser exclusive memory in the system, and specifically includes:
  • the method further includes: if the sum of the memory requested by the browser and the accumulated unreleased memory is greater than the maximum system memory requested by the browser, ending the application for the memory requested by the browser.
  • Another object of the present invention is a system for hybrid memory allocation, comprising:
  • a configuration module configured to configure a browser to monopolize the memory, and configure a threshold for using the browser memory
  • a determining module configured to determine whether the memory size requested by the browser exceeds a threshold of the browser memory usage
  • An allocation module configured to allocate, according to a threshold of the browser memory usage, a memory requested by the browser from a non-browser exclusive memory in the system;
  • the release module is configured to release the memory requested by the browser, and the other modules are reused.
  • More excellent also includes:
  • the allocating module is further configured to allocate, when the threshold of the browser memory usage is exceeded, the memory requested by the browser from the browser exclusive memory;
  • the release module is further configured to release the memory requested by the browser, and the browser exclusively reserves the memory and reclaims the released memory.
  • the configuration module is further configured to configure a maximum memory that can be used by the browser.
  • the maximum memory that the browser can use is the sum of the maximum system memory requested by the browser and the exclusive memory of the browser.
  • the memory size applied by the browser exceeds the threshold of the browser memory usage. Value,
  • the determining module is further configured to determine whether a sum of the memory requested by the browser and the accumulated unreleased memory is greater than a maximum value of a system memory requested by the browser;
  • the allocating module is further configured to: if the sum of the memory requested by the browser and the accumulated unreleased memory is less than or equal to a maximum system memory requested by the browser, allocate the non-browser exclusive memory in the system. The memory requested by the browser.
  • a further object of the present invention is to provide a browser comprising: the browser comprising the hybrid memory allocation system of any of the preceding claims.
  • the use of the mixed memory allocation can utilize the browser to monopolize the memory and use an efficient and economical memory management strategy, and can also avoid the memory pressure caused by the browser exclusive memory to the system, so that the browser does not generate a large amount of memory. Fragmentation wastes memory and speeds up memory requests.
  • FIG. 1 is a schematic flow chart of a method for hybrid memory allocation according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of another embodiment of a method for hybrid memory allocation according to the present invention
  • FIG. 3 is a schematic flowchart of another embodiment of a method for hybrid memory allocation according to the present invention
  • a schematic flowchart of a method for hybrid memory allocation according to an embodiment of the present invention includes:
  • Step S101 Configure the browser to monopolize the memory and configure the threshold for the browser memory usage.
  • the entire memory of a system is 256M.
  • the browser's exclusive memory is 4M.
  • the browser starts to initialize it starts to allocate 4M of the browser's exclusive memory, and the non-browser exclusive memory in the system.
  • the browser's exclusive memory is no less than 3M.
  • configure the threshold for browser memory usage The general configuration threshold is 4k bytes.
  • Step S102 Determine whether the memory size requested by the browser exceeds a threshold for using the browser memory. Specifically, when the user uses the browser, the user will dynamically apply for memory in a single time. For example, when the user clicks the "back" button on the browser, the browser will apply for memory to execute the command, and some commands occupy less memory, some commands. The memory used is large.
  • Step S103 If the threshold of the browser memory usage is exceeded, the memory requested by the browser is allocated from the non-browser exclusive memory in the system.
  • 1M is allocated from the non-browser exclusive memory 252M in the system for use by the browser.
  • Step S104 The memory requested by the browser is released, and other modules are reused.
  • the use of the mixed memory allocation can utilize the browser to monopolize the memory and use an efficient and economical memory management strategy, and can also avoid the memory pressure caused by the browser exclusive memory to the system, so that the browser does not generate a large amount of memory. Fragmentation wastes memory and speeds up memory requests.
  • Step S201 Configure the browser to monopolize the memory and configure the threshold for the browser memory usage.
  • the entire memory of a system is 256M.
  • the browser's exclusive memory is 4M.
  • the non-browser exclusive memory in the system is 252M.
  • the browser's exclusive memory is not less than 3M. .
  • configure the threshold for browser memory usage is not less than 3M.
  • Step S202 Determine whether the memory size requested by the browser exceeds the threshold of the browser memory usage. If not, go to step S203; if yes, go to step S205. Specifically, when the user uses the browser, the user will dynamically apply for memory in a single time. For example, when the user clicks the "back" button on the browser, the browser will apply for memory to execute the command, and some commands occupy less memory, some commands. The memory used is large.
  • Step S203 Allocating from the browser exclusive memory.
  • 3K is allocated from the browser's exclusive memory 4M to be provided to the browser.
  • Step S204 The memory is released, and the browser exclusively reserves the memory to recover the memory.
  • the browser when the browser completes the command, it will release the requested memory 3K, and the browser exclusive memory will recover 3K memory.
  • Step S205 Allocate the memory requested by the browser from the non-browser exclusive memory in the system. Specifically, when the memory requested by the browser is 1M, which is greater than the threshold of the browser memory usage 4K, 1M is allocated from the non-browser exclusive memory 252M in the system for use by the browser.
  • Step S206 Free memory is released, and other modules are reused.
  • Step S207 End.
  • Step S301 Configure the browser to monopolize the memory, configure the threshold of the browser memory usage, and configure the maximum memory that the browser can use.
  • the entire memory of a system is 256M.
  • the browser's exclusive memory is 4M.
  • the non-browser exclusive memory in the system is 252M.
  • the browser's exclusive memory is not less than 3M.
  • the general configuration threshold is 4k bytes.
  • the maximum memory that the browser can use is the maximum amount of system memory requested by the browser and the browser.
  • Step S302 Determine whether the memory size requested by the browser exceeds the threshold of the browser memory usage. If not, go to step S303; if yes, go to step S305.
  • the user when the user uses the browser, the user will dynamically apply for memory in a single time. For example, when the user clicks the "back" button on the browser, the browser will apply for memory to execute the command, and some commands occupy less memory, some commands.
  • the memory used is large.
  • Step S303 Allocating from the browser exclusive memory.
  • 3K is allocated from the browser's exclusive memory 4M to be provided to the browser.
  • Step S304 The memory is released, and the browser exclusively reserves the memory to recover the memory.
  • the browser when the browser completes the command, it will release the requested memory 3K, and the browser exclusive memory will recover 3K memory.
  • Step S305 Determine whether the sum of the memory requested by the browser and the accumulated unreleased memory is greater than the maximum value of the system memory requested by the browser. If yes, go to step S308; if less than or equal to, go to step S306.
  • the maximum system memory requested by the browser is the difference between the maximum memory that the browser can use and the browser's exclusive memory. Because each application's memory has its own life cycle, which is different, there is accumulated unreleased memory in the system memory.
  • Step S306 Allocate the memory requested by the browser from the non-browser exclusive memory in the system. Specifically, when the memory requested by the browser is 1M and the accumulated unreleased memory is 4M, the sum of the two is 5M, which is less than the difference between the maximum memory that can be used by the browser and the browser's exclusive memory is 96M, and then the system is not browsed. The device monopolizes the memory 252M to allocate 1M for the browser to use.
  • Step S307 The memory is released, and other modules are reused.
  • Step S308 End.
  • the effective and economical memory management strategy can also minimize the memory pressure caused by the browser's exclusive memory to the system, so that the browser does not waste memory due to a large amount of memory fragmentation, and improves the memory application speed.
  • FIG. 4 The structure of a system for hybrid memory allocation according to an embodiment of the present invention, which is shown in FIG. 4, further details the structure of a system for hybrid memory allocation according to an embodiment of the present invention.
  • the configuration module 401 is configured to configure the browser to monopolize the memory and configure the threshold for using the browser memory. Specifically, for example, the entire memory of a system is 256M. Before the browser is initialized, the browser's exclusive memory is 4M. The non-browser exclusive memory in the system is 252M. In general, the browser's exclusive memory is not less than 3M. . And configure the threshold for browser memory usage. The general configuration threshold is 4k bytes.
  • the determining module 402 is configured to determine whether the memory size requested by the browser exceeds a threshold used by the browser memory.
  • the user when the user uses the browser, the user will dynamically apply for memory in a single time. For example, when the user clicks the "back" button on the browser, the browser will apply for memory to execute the command, and some commands occupy less memory, some commands.
  • the memory used is large.
  • the allocation module 403 is configured to allocate the memory requested by the browser from the non-browser exclusive memory in the system if the threshold of the browser memory usage is exceeded.
  • 1M is allocated from the non-browser exclusive memory 252M in the system for use by the browser.
  • the release module 404 is configured to release the memory requested by the browser, and the other modules are reused.
  • the use of the mixed memory allocation can utilize the browser to monopolize the memory and use an efficient and economical memory management strategy, and can also avoid the memory pressure caused by the browser exclusive memory to the system, so that the browser does not generate a large amount of memory. Fragmentation wastes memory and speeds up memory requests.
  • the allocation module 403 is further configured to allocate the memory requested by the browser from the exclusive memory of the browser if the threshold of the memory usage of the browser is not exceeded.
  • the threshold value of the browser memory is less than 4K. Then 3K is allocated from the browser's exclusive memory 4M for use by the browser.
  • the release module 404 is also used to release the memory requested by the browser, and the browser exclusively reserves the memory released by the memory.
  • the browser when the browser completes the command, it will release the requested memory 3K, and the browser exclusive memory will recover 3K memory.
  • the configuration module 401 is also configured to configure the maximum memory that the browser can use.
  • the maximum memory that the browser can use is the sum of the maximum system memory requested by the browser and the browser's exclusive memory.
  • the maximum memory that can be used by the configuration browser is 100M
  • the determining module 402 is further configured to determine whether the sum of the memory requested by the browser and the accumulated unreleased memory is greater than the maximum system memory requested by the browser.
  • the maximum system memory requested by the browser is the difference between the maximum memory that the browser can use and the browser's exclusive memory. Because each application's memory has its own life cycle, which is different, there is still accumulated unreleased memory in the system memory.
  • the allocation module 403 is further configured to allocate, when the sum of the memory requested by the browser and the accumulated unreleased memory is less than or equal to the maximum system memory requested by the browser, the memory requested by the browser is allocated from the non-browser exclusive memory in the system.
  • the device monopolizes the memory 252M to allocate 1M for the browser to use.
  • the system provided by the present invention can be integrated into a browser.
  • the method, system and browser of the hybrid memory allocation provided by the present invention can be used in a general system or in an embedded system.
  • a storage medium such as a ROM/RAM, a magnetic disk, an optical disk, or the like, includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform certain embodiments of the present invention or certain embodiments. Part of the method described.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开了一种混合内存分配的方法,其特征在于,包括:配置浏览器独占内存,配置浏览器内存使用的阈值;判断浏览器申请的内存大小是否超过所述浏览器内存使用的阈值;若超过所述浏览器内存使用的阈值,从系统中非浏览器独占的内存中分配所述浏览器申请的内存;释放所述浏览器申请的内存,其他模块重新使用。本发明还公开了一种混合内存分配的系统及浏览器。实施上述实施例,使用混合内存分配,既可以利用浏览器独占内存使用高效、节约的内存管理策略,又可以最大限度避免浏览器独占内存给系统造成的内存压力,使浏览器不因产生大量内存碎片而浪费内存,提高内存申请速度。

Description

一种混合内存分配的方法、 系统及浏览器 本申请要求于 2012 年 7 月 28 日提交中国专利局, 申请号为 201210263567.9、 发明名称为 "一种混合内存分配的方法、 系统及浏览器" 的 中国专利申请的优先权, 其全部内容通过弓 I用结合在本申请中。 技术领域
本发明涉及内存分配领域, 尤其涉及一种混合内存分配的方法、 系统及浏 览器。 背景技术
浏览器是指可以显示网页服务器或者文件系统的 HTML文件内容, 并让 用户与这些文件交互的一种软件。一般浏览器需要独占一定量的内存才能够正 常运行, 但是在实际的某些项目中, 比如嵌入式项目, 内存比较紧张, 无法提 供给浏览器大块的独占内存。 发明内容
本发明实施例在于提供一种混合内存分配的方法、 系统及浏览器, 利用混 合内存分配机制, 提高内存使用率。
本发明是这样实现的, 一种混合内存分配的方法, 包括:
配置浏览器独占内存, 配置浏览器内存使用的阈值;
判断浏览器申请的内存大小是否超过所述浏览器内存使用的阈值; 若超过所述浏览器内存使用的阈值,从系统中非浏览器独占的内存中分配 所述浏览器申请的内存;
释放所述浏览器申请的内存, 其他模块重新使用。
较优的 ,所述判断浏览器申请的内存大小是否超过所述浏览器内存使用的 阈值之后, 还包括:
若没有超过所述浏览器内存使用的阈值,从所述浏览器独占内存中分配所 述浏览器申请的内存;
释放所述浏览器申请的内存, 所述浏览器独占内存回收释放的内存。
较优的,所述配置浏览器独占内存,配置浏览器内存使用的阈值,还包括: 配置浏览器能使用的最大内存,所述浏览器能使用的最大内存为浏览器申 请的系统内存最大值与所述浏览器独占内存之和。
较优的, 所述若超过所述浏览器内存使用的阈值,从系统中非浏览器独占 的内存中分配所述浏览器申请的内存, 具体还包括:
判断所述浏览器申请的内存与累积未释放内存之和是否大于所述浏览器 申请的系统内存最大值, 若小于或等于,从系统中非浏览器独占的内存中分配 所述浏览器申请的内存。
较优的,还包括, 若所述浏览器申请的内存与累积未释放内存之和大于所 述浏览器申请的系统内存最大值, 则结束所述浏览器申请的内存的申请。
本发明的另一目的在于一种混合内存分配的系统, 包括:
配置模块, 用于配置浏览器独占内存, 配置浏览器内存使用的阈值; 判断模块,用于判断浏览器申请的内存大小是否超过所述浏览器内存使用 的阈值;
分配模块, 用于若超过所述浏览器内存使用的阈值,从系统中非浏览器独 占的内存中分配所述浏览器申请的内存;
释放模块, 用于释放所述浏览器申请的内存, 其他模块重新使用。
较优的, 还包括:
所述分配模块,还用于若没有超过所述浏览器内存使用的阈值,从所述浏 览器独占内存中分配所述浏览器申请的内存;
所述释放模块,还用于释放所述浏览器申请的内存, 所述浏览器独占内存 回收释放的内存。
较优的, 所述配置模块, 还用于配置浏览器能使用的最大内存, 所述浏览 器能使用的最大内存为浏览器申请的系统内存最大值与所述浏览器独占内存 之和。
较优的,还包括, 当浏览器申请的内存大小超过所述浏览器内存使用的阈 值时,
所述判断模块,还用于判断所述浏览器申请的内存与累积未释放内存之和 是否大于所述浏览器申请的系统内存最大值;
所述分配模块,还用于若所述浏览器申请的内存与累积未释放内存之和小 于或等于所述浏览器申请的系统内存最大值,从系统中非浏览器独占的内存中 分配所述浏览器申请的内存。
本发明的再一目的在于提供一种浏览器, 包括: 所述浏览器包括上述权利 要求任一项所述的混合内存分配的系统。
实施上述实施例,使用混合内存分配, 既可以利用浏览器独占内存使用高 效、 节约的内存管理策略, 又可以最大限度避免浏览器独占内存给系统造成的 内存压力, 使浏览器不因产生大量内存碎片而浪费内存, 提高内存申请速度。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付 出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例的一种混合内存分配的方法流程示意图;
图 2是本发明一种混合内存分配的方法的另一实施例的流程示意图; 图 3是本发明一种混合内存分配的方法的另一实施例的流程示意图; 图 4是本发明实施例的一种混合内存分配的系统的结构示意图。 具体实施方式
为了使本发明所要解决的技术问题、 技术方案及有益效果更加清楚明白, 以下结合附图及实施例, 对本发明进行进一步详细说明。
请参阅图 1示出的本发明实施例的一种混合内存分配的方法流程示意图, 包括:
步骤 S101 : 配置浏览器独占内存, 配置浏览器内存使用的阈值。 具体的, 例如一个系统整个内存为 256M, 在浏览器初始化之前, 配置浏 览器独占内存为 4M, 浏览器开始初始化时, 即开始分配浏览器独占内存 4M, 则系统中非浏览器独占内存的大小为 252M, —般而言, 浏览器独占内存不小 于 3M。 并配置浏览器内存使用的阈值, 一般配置阈值为 4k字节。
步骤 S102: 判断浏览器申请的内存大小是否超过浏览器内存使用的阈值。 具体的, 用户在使用浏览器时, 会单次动态申请内存, 比如用户点击浏览 器上 "返回"键时, 浏览器就会申请内存来执行该命令, 有些命令占用的内存 比较小, 有些命令占用的内存较大。
步骤 S103: 若超过浏览器内存使用的阈值, 从系统中非浏览器独占的内 存中分配浏览器申请的内存。
具体的, 当浏览器申请的内存为 1M时, 大于浏览器内存使用的阈值 4K, 则从系统中非浏览器独占的内存 252M中来分配 1M提供给浏览器使用。
步骤 S104: 释放浏览器申请的内存, 其他模块重新使用。
具体的, 当浏览器完成命令后, 会释放申请的内存 1M, 系统中其他的模 块来重新使用。
实施上述实施例,使用混合内存分配, 既可以利用浏览器独占内存使用高 效、节约的内存管理策略, 又可以最大限度避免浏览器独占内存给系统造成的 内存压力, 使浏览器不因产生大量内存碎片而浪费内存, 提高内存申请速度。 下面结合图 2 示出的本发明一种混合内存分配的方法的另一实施例的流 程示意图, 方法步骤包括:
步骤 S201 : 配置浏览器独占内存, 配置浏览器内存使用的阈值。
具体的, 例如一个系统整个内存为 256M, 在浏览器初始化之前, 配置浏 览器独占内存为 4M, 则系统中非浏览器独占内存的大小为 252M, —般而言, 浏览器独占内存不小于 3M。 并配置浏览器内存使用的阈值, 一般配置阈值为
4k字节。
步骤 S202: 判断浏览器申请的内存大小是否超过浏览器内存使用的阈值, 如果没超过, 进入步骤 S203; 如果超过, 进入步骤 S205。 具体的, 用户在使用浏览器时, 会单次动态申请内存, 比如用户点击浏览 器上 "返回"键时, 浏览器就会申请内存来执行该命令, 有些命令占用的内存 比较小, 有些命令占用的内存较大。
步骤 S203: 从浏览器独占内存中分配。
具体的, 当浏览器申请的内存为 3K时, 小于浏览器内存使用的阈值 4K, 则从浏览器独占的内存 4M中来分配 3K提供给浏览器使用。
步骤 S204: 释放内存, 浏览器独占内存回收该内存。
具体的, 当浏览器完成命令后, 会释放申请的内存 3K, 浏览器独占内存 会回收 3K内存。
步骤 S205: 从系统中非浏览器独占的内存中分配浏览器申请的内存。 具体的, 当浏览器申请的内存为 1M时, 大于浏览器内存使用的阈值 4K, 则从系统中非浏览器独占的内存 252M中来分配 1M提供给浏览器使用。
步骤 S206: 释放内存, 其他模块重新使用。
具体的, 当浏览器完成命令后, 会释放申请的内存 1M, 系统中其他的模 块来重新使用。
步骤 S207: 结束。
实施上述实施例,使用混合内存分配, 既可以利用浏览器独占内存使用高 效、节约的内存管理策略, 又可以最大限度避免浏览器独占内存给系统造成的 内存压力, 使浏览器不因产生大量内存碎片而浪费内存, 提高内存申请速度。 下面结合图 3 示出的本发明一种混合内存分配的方法的另一实施例的流 程示意图, 方法步骤包括:
步骤 S301 : 配置浏览器独占内存, 配置浏览器内存使用的阈值, 配置浏 览器能使用的最大内存。
具体的, 例如一个系统整个内存为 256M, 在浏览器初始化之前, 配置浏 览器独占内存为 4M, 则系统中非浏览器独占内存的大小为 252M, —般而言, 浏览器独占内存不小于 3M。 并配置浏览器内存使用的阈值, 一般配置阈值为 4k字节。 浏览器能使用的最大内存为浏览器申请的系统内存最大值与浏览器 独占内存之和, 如果配置浏览器能使用的最大内存为 100M, 则代表浏览器申 请的系统内存最大值为 100M-4M=96M。
步骤 S302: 判断浏览器申请的内存大小是否超过浏览器内存使用的阈值, 如果没超过, 进入步骤 S303; 如果超过, 进入步骤 S305。
具体的, 用户在使用浏览器时, 会单次动态申请内存, 比如用户点击浏览 器上 "返回"键时, 浏览器就会申请内存来执行该命令, 有些命令占用的内存 比较小, 有些命令占用的内存较大。
步骤 S303: 从浏览器独占内存中分配。
具体的, 当浏览器申请的内存为 3K时, 小于浏览器内存使用的阈值 4K, 则从浏览器独占的内存 4M中来分配 3K提供给浏览器使用。
步骤 S304: 释放内存, 浏览器独占内存回收该内存。
具体的, 当浏览器完成命令后, 会释放申请的内存 3K, 浏览器独占内存 会回收 3K内存。
步骤 S305: 判断浏览器申请的内存与累积未释放内存之和是否大于浏览 器申请的系统内存最大值, 若大于, 进入步骤 S308; 若小于或等于, 进入步 骤 S306。
具体的,浏览器申请的系统内存最大值为浏览器能使用的最大内存与浏览 器独占内存之差。 因为每次申请的内存都有自己的生命周期, 各不相同, 所以 系统内存中海存在累积未释放内存。
步骤 S306: 从系统中非浏览器独占的内存中分配浏览器申请的内存。 具体的, 当浏览器申请的内存为 1M, 累积未释放内存为 4M时, 两者之 和为 5M, 小于浏览器能使用的最大内存与浏览器独占内存之差 96M, 则从系 统中非浏览器独占的内存 252M中来分配 1M提供给浏览器使用。
步骤 S307: 释放内存, 其他模块重新使用。
具体的, 当浏览器完成命令后, 会释放申请的内存 1M, 系统中其他的模 块来重新使用。
步骤 S308: 结束。
实施上述实施例,使用混合内存分配, 既可以利用浏览器独占内存使用高 效、节约的内存管理策略, 又可以最大限度避免浏览器独占内存给系统造成的 内存压力, 使浏览器不因产生大量内存碎片而浪费内存, 提高内存申请速度。 下面结合图 4 示出的本发明实施例的一种混合内存分配的系统的结构示 意图, 进一步详细说明本发明实施例一种混合内存分配的系统的结构。
配置模块 401 , 用于配置浏览器独占内存, 配置浏览器内存使用的阈值。 具体的, 例如一个系统整个内存为 256M, 在浏览器初始化之前, 配置浏 览器独占内存为 4M, 则系统中非浏览器独占内存的大小为 252M, —般而言, 浏览器独占内存不小于 3M。 并配置浏览器内存使用的阈值, 一般配置阈值为 4k字节。
判断模块 402 , 用于判断浏览器申请的内存大小是否超过浏览器内存使用 的阈值。
具体的, 用户在使用浏览器时, 会单次动态申请内存, 比如用户点击浏览 器上 "返回"键时, 浏览器就会申请内存来执行该命令, 有些命令占用的内存 比较小, 有些命令占用的内存较大。
分配模块 403 , 用于若超过浏览器内存使用的阈值, 从系统中非浏览器独 占的内存中分配浏览器申请的内存。
具体的, 当浏览器申请的内存为 1M时, 大于浏览器内存使用的阈值 4K, 则从系统中非浏览器独占的内存 252M中来分配 1M提供给浏览器使用。
释放模块 404, 用于释放该浏览器申请的内存, 其他模块重新使用。
具体的, 当浏览器完成命令后, 会释放申请的内存 1M, 系统中其他的模 块来重新使用。
实施上述实施例,使用混合内存分配, 既可以利用浏览器独占内存使用高 效、 节约的内存管理策略, 又可以最大限度避免浏览器独占内存给系统造成的 内存压力, 使浏览器不因产生大量内存碎片而浪费内存, 提高内存申请速度。
较优的, 分配模块 403 , 还用于若没有超过浏览器内存使用的阈值, 从所 述浏览器独占内存中分配浏览器申请的内存。
具体的, 当浏览器申请的内存为 3K时, 小于浏览器内存使用的阈值 4K, 则从浏览器独占的内存 4M中来分配 3K提供给浏览器使用。
释放模块 404, 还用于释放该浏览器申请的内存, 浏览器独占内存回收释 放的内存。
具体的, 当浏览器完成命令后, 会释放申请的内存 3K, 浏览器独占内存 会回收 3K内存。
较优的, 配置模块 401 , 还用于配置浏览器能使用的最大内存, 浏览器能 使用的最大内存为浏览器申请的系统内存最大值与浏览器独占内存之和。
具体的, 如果配置浏览器能使用的最大内存为 100M, 则代表浏览器申请 的系统内存最大值为 100M-4M=96M。
当浏览器申请的内存大小超过所述浏览器内存使用的阈值时,
判断模块 402, 还用于判断浏览器申请的内存与累积未释放内存之和是否 大于浏览器申请的系统内存最大值。
具体的,浏览器申请的系统内存最大值为浏览器能使用的最大内存与浏览 器独占内存之差。 因为每次申请的内存都有自己的生命周期, 各不相同, 所以 系统内存中还存在累积未释放内存。
分配模块 403 , 还用于若浏览器申请的内存与累积未释放内存之和小于或 等于浏览器申请的系统内存最大值,从系统中非浏览器独占的内存中分配浏览 器申请的内存。
具体的, 当浏览器申请的内存为 1M, 累积未释放内存为 4M时, 两者之 和为 5M, 小于浏览器能使用的最大内存与浏览器独占内存之差 96M, 则从系 统中非浏览器独占的内存 252M中来分配 1M提供给浏览器使用。 本发明提供的系统可以集成在浏览器中,本发明提供的一种混合内存分配 的方法、 系统及浏览器可以用于一般的系统中, 也可以应用于嵌入式系统中。
需要说明的是, 通过以上的实施方式的描述, 本领域的技术人员可以清楚 地了解到本发明可借助软件加必需的硬件平台的方式来实现,当然也可以全部 通过硬件来实施。基于这样的理解, 本发明的技术方案对背景技术做出贡献的 全部或者部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在 存储介质中, 如 ROM/RAM、 磁碟、 光盘等, 包括若干指令用以使得一台计算 机设备(可以是个人计算机, 服务器, 或者网络设备等)执行本发明各个实施 例或者实施例的某些部分所述的方法。
以上所揭露的仅为本发明实施例中的较佳实施例而已,当然不能以此来限 定本发明之权利范围, 因此依本发明权利要求所作的等同变化,仍属本发明所 涵盖的范围。

Claims

权 利 要 求
1、 一种混合内存分配的方法, 其特征在于, 包括:
配置浏览器独占内存, 配置浏览器内存使用的阈值;
判断浏览器申请的内存大小是否超过所述浏览器内存使用的阈值; 若超过所述浏览器内存使用的阈值,从系统中非浏览器独占的内存中分配 所述浏览器申请的内存;
释放所述浏览器申请的内存, 其他模块重新使用。
2、 如权利要求 1所述的方法, 其特征在于, 所述判断浏览器申请的内存 大小是否超过所述浏览器内存使用的阈值之后, 还包括:
若没有超过所述浏览器内存使用的阈值,从所述浏览器独占内存中分配所 述浏览器申请的内存;
释放所述浏览器申请的内存, 所述浏览器独占内存回收释放的内存。
3、 如权利要求 1或 2所述的方法, 其特征在于, 所述配置浏览器独占内 存, 配置浏览器内存使用的阈值, 还包括:
配置浏览器能使用的最大内存,所述浏览器能使用的最大内存为浏览器申 请的系统内存最大值与所述浏览器独占内存之和。
4、 如权利要求 3所述的方法, 其特征在于, 所述若超过所述浏览器内存 使用的阈值,从系统中非浏览器独占的内存中分配所述浏览器申请的内存, 具 体还包括:
判断所述浏览器申请的内存与累积未释放内存之和是否大于所述浏览器 申请的系统内存最大值, 若小于或等于,从系统中非浏览器独占的内存中分配 所述浏览器申请的内存。
5、 如权利要求 4所述的方法, 其特征在于, 还包括, 若所述浏览器申请 的内存与累积未释放内存之和大于所述浏览器申请的系统内存最大值,则结束 所述浏览器申请的内存的申请。
6、 一种混合内存分配的系统, 其特征在于, 包括:
配置模块, 用于配置浏览器独占内存, 配置浏览器内存使用的阈值; 判断模块,用于判断浏览器申请的内存大小是否超过所述浏览器内存使用 的阈值;
分配模块, 用于若超过所述浏览器内存使用的阈值,从系统中非浏览器独 占的内存中分配所述浏览器申请的内存;
释放模块, 用于释放所述浏览器申请的内存, 其他模块重新使用。
7、 如权利要求 6所述的系统, 其特征在于, 还包括:
所述分配模块,还用于若没有超过所述浏览器内存使用的阈值,从所述浏 览器独占内存中分配所述浏览器申请的内存;
所述释放模块,还用于释放所述浏览器申请的内存, 所述浏览器独占内存 回收释放的内存。
8、 如权利要求 6或 7所述的系统, 其特征在于, 所述配置模块, 还用于 配置浏览器能使用的最大内存,所述浏览器能使用的最大内存为浏览器申请的 系统内存最大值与所述浏览器独占内存之和。
9、 如权利要求 8所述的系统, 其特征在于, 还包括, 当浏览器申请的内 存大小超过所述浏览器内存使用的阈值时,
所述判断模块,还用于判断所述浏览器申请的内存与累积未释放内存之和 是否大于所述浏览器申请的系统内存最大值;
所述分配模块,还用于若所述浏览器申请的内存与累积未释放内存之和小 于或等于所述浏览器申请的系统内存最大值,从系统中非浏览器独占的内存中 分配所述浏览器申请的内存。
10、 一种浏览器, 其特征在于, 所述浏览器包括权利要求 6至 9任一项所 述的混合内存分配的系统。
PCT/CN2013/071798 2012-07-28 2013-02-22 一种混合内存分配的方法、系统及浏览器 WO2014019358A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210263567.9 2012-07-28
CN 201210263567 CN102880551A (zh) 2012-07-28 2012-07-28 一种混合内存分配的方法、系统及浏览器

Publications (1)

Publication Number Publication Date
WO2014019358A1 true WO2014019358A1 (zh) 2014-02-06

Family

ID=47481885

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/071798 WO2014019358A1 (zh) 2012-07-28 2013-02-22 一种混合内存分配的方法、系统及浏览器

Country Status (2)

Country Link
CN (1) CN102880551A (zh)
WO (1) WO2014019358A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102880551A (zh) * 2012-07-28 2013-01-16 深圳市同洲电子股份有限公司 一种混合内存分配的方法、系统及浏览器
CN104636364B (zh) * 2013-11-08 2019-04-16 腾讯科技(深圳)有限公司 浏览器的内存释放方法及装置
CN105740158A (zh) * 2014-12-11 2016-07-06 广州市动景计算机科技有限公司 减少便携式终端设备上浏览器内存占用的方法与装置
CN106201717A (zh) * 2016-07-01 2016-12-07 珠海市魅族科技有限公司 一种管理系统内存的方法及终端
CN109213596B (zh) * 2018-08-01 2023-03-10 青岛海信移动通信技术股份有限公司 一种分配终端内存的方法和设备
CN108810178A (zh) * 2018-09-20 2018-11-13 量子云未来(北京)信息科技有限公司 一种超大文件上传方法及装置
CN109669877B (zh) * 2018-12-11 2023-04-04 腾讯科技(深圳)有限公司 内存管理方法、装置、终端及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064642A1 (en) * 2002-10-01 2004-04-01 James Roskind Automatic browser web cache resizing system
CN101320353A (zh) * 2008-07-18 2008-12-10 四川长虹电器股份有限公司 嵌入式浏览器缓存设计方法
CN101344861A (zh) * 2007-07-10 2009-01-14 凤凰微电子(中国)有限公司 一种智能卡内存管理方法
CN102368258A (zh) * 2011-09-30 2012-03-07 广州市动景计算机科技有限公司 一种网页页面缓存管理方法及其系统
CN102880551A (zh) * 2012-07-28 2013-01-16 深圳市同洲电子股份有限公司 一种混合内存分配的方法、系统及浏览器

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040064642A1 (en) * 2002-10-01 2004-04-01 James Roskind Automatic browser web cache resizing system
CN101344861A (zh) * 2007-07-10 2009-01-14 凤凰微电子(中国)有限公司 一种智能卡内存管理方法
CN101320353A (zh) * 2008-07-18 2008-12-10 四川长虹电器股份有限公司 嵌入式浏览器缓存设计方法
CN102368258A (zh) * 2011-09-30 2012-03-07 广州市动景计算机科技有限公司 一种网页页面缓存管理方法及其系统
CN102880551A (zh) * 2012-07-28 2013-01-16 深圳市同洲电子股份有限公司 一种混合内存分配的方法、系统及浏览器

Also Published As

Publication number Publication date
CN102880551A (zh) 2013-01-16

Similar Documents

Publication Publication Date Title
WO2014019358A1 (zh) 一种混合内存分配的方法、系统及浏览器
JP5510556B2 (ja) 仮想マシンのストレージスペースおよび物理ホストを管理するための方法およびシステム
EP3481007B1 (en) Method, apparatus and management server for processing resource pool
WO2011097884A1 (zh) 内存分配方法及装置
US9098379B2 (en) Computing reusable image components to minimize network bandwidth usage
JP2014520346A5 (zh)
CN103078965B (zh) 虚拟机的ip地址管理方法
WO2014094422A1 (zh) 虚拟机规格调整方法及装置
JP2013514588A5 (zh)
KR102077149B1 (ko) 메모리 관리 방법 및 장치
WO2016107394A1 (zh) 虚拟机的深度证明方法、计算设备和计算机系统
TW201336264A (zh) 自動擴充虛擬機的方法
WO2008132924A1 (ja) 仮想計算機システムおよびその最適化方法
CN105630576B (zh) 一种虚拟化平台中的数据处理方法及装置
WO2014089976A1 (zh) 虚拟机分配方法及装置
WO2011095086A1 (zh) 一种基于linux系统的设备及其应用启动的方法
CN110750336B (zh) 一种OpenStack虚拟机内存热扩容方法
JP2014517950A5 (zh)
CN108255608B (zh) 一种内存池的管理方法
CN103729236A (zh) 一种限制云计算用户资源使用额度的方法
CN103309745A (zh) 云架构的虚拟资源配置的方法及装置
WO2018228344A1 (zh) 内存重整方法、装置、电子设备及可读存储介质
TW201428507A (zh) 記憶體管理系統及方法
KR101331098B1 (ko) 메모리압축 스왑도구를 이용하는 가상화 임베디드 시스템 및 방법
CN105208137A (zh) 一种互联网协议ip地址分配方法、装置、服务器和终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13824985

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13824985

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 09/04/2015)

122 Ep: pct application non-entry in european phase

Ref document number: 13824985

Country of ref document: EP

Kind code of ref document: A1