CN110597738B - Memory release method, terminal and computer readable storage medium - Google Patents
Memory release method, terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN110597738B CN110597738B CN201910884819.1A CN201910884819A CN110597738B CN 110597738 B CN110597738 B CN 110597738B CN 201910884819 A CN201910884819 A CN 201910884819A CN 110597738 B CN110597738 B CN 110597738B
- Authority
- CN
- China
- Prior art keywords
- dom
- iframe
- memory
- objects
- deleting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 15
- 230000005055 memory storage Effects 0.000 claims abstract description 12
- 238000003780 insertion Methods 0.000 claims abstract description 7
- 230000037431 insertion Effects 0.000 claims abstract description 7
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004140 cleaning Methods 0.000 description 3
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
Abstract
The invention discloses a memory release method, a terminal and a computer readable storage medium, which belong to the field of IE browser memory release and solve the technical problem of releasing an iframe frame under the condition that the use of an integral frame is not affected by the memory occupied by the iframe frame in the IE browser. The method comprises the following steps: for the circularly referenced object, constructing memory storage through DOM elements, deleting the DOM elements and deleting additional memory storage; when an object new insertion is called between iframe pages in an IE browser through the intermediate object, the intermediate object is marked and deleted; for closed iframe pages, the iframe-based marking algorithm marks unreferenced objects and deletes the release. The processor in the terminal is configured to invoke the program instructions to perform a method of freeing memory as described above. The program instructions in the readable storage medium when executed by the processor perform a method of freeing memory as described above.
Description
Technical Field
The invention relates to the field of memory release of IE browsers, in particular to a memory release method, a terminal and a computer readable storage medium.
Background
With the development of internet informatization, government websites, office flows and the like are also in pace, various websites grow exponentially, and an iframe framework is a mode widely adopted by people in a plurality of websites, and the iframe framework gains the favor of wide web application developers with the advantages of simplicity, easiness in use, simplicity in deployment and the like and is further widely applied. When the iframe is used in the ie browser, the memory used by the iframe is always high when the pages are continuously switched, and the memory occupation is larger when the iframe pages are opened, so that the memory use is not obviously reduced even if all the opened iframe pages are closed. The high memory occupancy results in browser stuck and even stuck crashes.
How the memory occupied by the iframe frame in the ie browser can be released without affecting the overall frame usage.
Disclosure of Invention
The technical task of the invention is to provide a memory release method, a terminal and a computer readable storage medium for solving the problem of how to release the memory occupied by an iframe frame in an ie browser under the condition of not affecting the use of the whole frame.
In a first aspect, the present invention provides a memory release method for releasing a memory of an IE browser iframe, where the method includes:
for the circularly referenced object, constructing memory storage through DOM elements, deleting the DOM elements and deleting additional memory storage;
when an object new insertion is called between iframe pages in an IE browser through the intermediate object, the intermediate object is marked and deleted;
for closed iframe pages, the iframe-based marking algorithm marks unreferenced objects and deletes the release.
Preferably, for circularly referenced objects,
the memory storage is built through DOM elements, the DOM elements are deleted, and the additional memory storage is deleted at the same time, and the method comprises the following steps:
creating an object through a newly created DOM element, and constructing an instance DOM element, wherein the instance DOM element is used for storing the object element;
establishing an association relation between the instance DOM element and the newly built DOM element, and attaching the instance DOM element to a reference storage sequence of the newly built DOM element;
and deleting the corresponding instance DOM element based on the association relationship while deleting the newly built DOM element.
Preferably, when an object new insertion is called between iframe pages in an IE browser through an intermediate object, the intermediate object is marked and deleted, and the method comprises the following steps:
before new insertion of an object is called between iframe pages in an IE browser, the sequence specification is configured;
based on the sequence specification, creating a DOM structure and a method attribute of a calling object between iframe pages, storing the DOM structure of the calling object into a structure stack, and storing the method attribute of the calling object into a corresponding attribute stack;
creating and marking an intermediate object, and establishing an association relationship between a DOM structure and a method attribute of the calling object through the intermediate object;
and searching the corresponding method attribute through the intermediate object, and deleting the intermediate object after searching the corresponding DOM structure based on the method attribute for deletion.
Preferably, the association relation between the DOM structure and the method attribute of the calling object is established through the intermediate object, so that script binding is carried out on the intermediate object and the DOM structure and the method attribute of the calling object.
Preferably, for a closed iframe page, the iframe frame-based marking algorithm marks unreferenced objects and deletes releases, including:
encapsulating a marking algorithm of the iframe frame and forming a marking interface;
for DOM elements which are not referenced any more in the closed iframe page, calling a marking interface and marking by a marking algorithm of the iframe frame;
for marked DOM elements that are no longer referenced, delete releases are made.
Preferably, the deleting the intermediate objects and the unreferenced objects includes deleting DOM elements, packages, and variables.
In a second aspect, the present invention provides a terminal comprising a processor, an input device, an output device and a memory, the processor, the input device, the output device and the memory being interconnected, the memory being for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform a method of freeing memory according to any of the first aspects.
In a third aspect, the present invention provides a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, perform a method of freeing memory as claimed in any of the first aspects.
The memory release method, the terminal and the computer readable storage medium have the following advantages: the method solves the problem that the iframe web application under the IE kernel browser can circularly reference the memory, cross pages and release the memory of the closed pages, and realizes the recycling of the browser memory.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
The invention is further described below with reference to the accompanying drawings.
Fig. 1 is a flow chart of a memory release method according to embodiment 1.
Detailed Description
The invention will be further described with reference to the accompanying drawings and specific examples, so that those skilled in the art can better understand the invention and implement it, but the examples are not meant to limit the invention, and the technical features of the embodiments of the invention and the examples can be combined with each other without conflict.
The embodiment of the invention provides a memory release method, a terminal and a computer readable storage medium, which are used for solving the technical problem of how to release the memory occupied by an iframe frame in an ie browser under the condition that the use of an integral frame is not affected.
Example 1:
the memory release method is used for memory release of the IE browser iframe. The method comprises three working conditions of cleaning a circular reference memory, a cross-page memory and a closed iframe page memory.
Release of working condition one and cyclic reference memory
The cyclic reference to several households is the root of each leakage, and in general, the memory reclamation method of the IE browser can have a good effect on the same, but no sound memory reclamation method is provided in the IE browser (below IE 10). Aiming at the problems, the embodiment constructs the memory storage through the DOM element, deletes the DOM element and deletes the additional memory storage at the same time, and the specific flow is as follows:
s100, constructing an instance DOM element when creating an object through the newly created DOM element, wherein the instance DOM element is used for storing the object element;
s200, establishing an association relation between the instance DOM element and the newly built DOM element, and attaching the instance DOM element to a reference storage sequence of the newly built DOM element;
s300, deleting the new DOM element and simultaneously deleting the corresponding instance DOM element based on the association relation.
And adding the instance DOM element into the reference storage sequence of the new DOM element, namely marking the application program model corresponding to the object element when the association relation between the instance DOM element and the new DOM element is established, so that the application program model can always be used for processing the instance DOM element, and cleaning file unloading.
Release of Condition two, cross-Page memory
The newly created insertion of the call object between the iframe pages in the IE browser is almost always created by the intermediate object, and after the creation is completed, the cleaning of the intermediate object is not clean, especially when the call object creation process includes a script. Aiming at the problems, the method establishes an association relation through the intermediate objects after the calling objects are sequentially created for the calling objects among the cross-iframe pages, and marks and deletes the intermediate objects.
The specific flow is as follows:
s100, before new insertion of an object is called between iframe pages in an IE browser, the configuration sequence is standard;
s200, creating DOM structures and method attributes of calling objects between iframe pages based on sequence specifications, storing the DOM structures of the calling objects in a structure stack, and storing the method attributes of the calling objects in a corresponding attribute stack;
s300, creating and marking an intermediate object, and establishing an association relationship between a DOM structure and a method attribute of the calling object through the intermediate object;
s400, searching the corresponding method attribute through the intermediate object, and deleting the intermediate object after searching the corresponding DOM structure based on the method attribute for deletion.
In the step S300, an association relationship between the DOM structure of the calling object and the method attribute is established through the intermediate object, which is: and script binding is carried out on the DOM structure and the method attribute of the intermediate object and the calling object.
Working condition three, internal memory of closed iframe page
in order to increase the loading speed, the IE browser under the iframe caches the content and the variable method in the iframe, and the content and the variable method cannot be released from the memory when the IE browser is closed. For the above problem, for the closed iframe page, the iframe-based marking algorithm marks unreferenced objects and deletes the release. The specific flow is as follows:
s100, packaging a marking algorithm of the iframe frame, and forming a marking interface;
s200, calling a marking interface for DOM elements which are not referenced any more in the closed iframe page and marking the DOM elements through a marking algorithm of the iframe frame;
s300, deleting and releasing marked DOM elements which are not referenced any more.
In this embodiment, the marking algorithm of the iframe frame is g3.gcweakmapc current selector (), and the algorithm performs recursive query from the root of the window to mark objects that can arrive from the root, and the unmarked objects are the unmarked objects.
The method comprises the steps of deleting an intermediate object in a second working condition and deleting an unreferenced object in a third working condition, wherein the second working condition comprises the step of deleting DOM elements, packages and variables.
According to the invention, through releasing the memory under three working conditions, the memory occupied by the browser can be reduced when a user uses the IE browser, so that the web application can be used more smoothly.
The step S100 encapsulates the marking algorithm of the iframe frame and forms a marking interface, and the encapsulation method adopted is an existing method and will not be described in detail herein.
Example 2:
a terminal of the present invention includes a processor, an input device, an output device, and a memory, the processor, the input device, the output device, and the memory being interconnected, the memory being for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform a method of freeing memory as disclosed in embodiment 1.
Example 3:
a computer readable storage medium of the present invention stores a computer program comprising program instructions which, when executed by a processor, perform a method of freeing memory as disclosed in embodiment 1.
The above-described embodiments are merely preferred embodiments for fully explaining the present invention, and the scope of the present invention is not limited thereto. Equivalent substitutions and modifications will occur to those skilled in the art based on the present invention, and are intended to be within the scope of the present invention. The protection scope of the invention is subject to the claims.
Claims (5)
1. The memory release method is characterized by being used for memory release of an IE browser iframe, and comprises the following steps:
for the circularly referenced object, constructing memory storage through DOM elements, deleting the DOM elements and deleting additional memory storage;
for the calling objects among the cross-iframe pages, establishing an association relation through the intermediate objects after the calling objects are sequentially created, and marking and deleting the intermediate objects;
for the closed iframe page, marking unreferenced objects by a marking algorithm based on the iframe and deleting release;
the memory storage is built through DOM elements, the DOM elements are deleted, and the additional memory storage is deleted at the same time, and the method comprises the following steps:
creating an object through the newly created DOM element, and constructing an instance DOM element, wherein the instance DOM element is used for storing the object element;
establishing an association relation between the instance DOM element and the newly built DOM element, and attaching the instance DOM element to a reference storage sequence of the newly built DOM element;
deleting the new DOM element and deleting the corresponding instance DOM element based on the association relation;
for the call objects among the cross-iframe pages, establishing an association relation through the intermediate objects after creating the call objects in sequence, and marking and deleting the intermediate objects, comprising the following steps:
before new insertion of an object is called between iframe pages in an IE browser, the sequence specification is configured;
based on the sequence specification, creating a DOM structure and a method attribute of a calling object between iframe pages, storing the DOM structure of the calling object into a structure stack, and storing the method attribute of the calling object into a corresponding attribute stack;
creating and marking an intermediate object, and establishing an association relationship between a DOM structure and a method attribute of the calling object through the intermediate object;
searching corresponding method attributes through the intermediate objects, and deleting the intermediate objects after searching corresponding DOM structures based on the method attributes;
for a closed iframe page, the iframe frame-based marking algorithm marks unreferenced objects and deletes releases, including:
encapsulating a marking algorithm of the iframe frame and forming a marking interface;
for DOM elements which are not referenced any more in the closed iframe page, calling a marking interface and marking by a marking algorithm of the iframe frame;
for marked DOM elements that are no longer referenced, delete releases are made.
2. The memory release method according to claim 1, wherein the association relationship between the DOM structure and the method attribute of the call object is established by the intermediate object, so as to perform script binding on the intermediate object and the DOM structure and the method attribute of the call object.
3. A memory release method according to any of claims 1-2, wherein said deleting intermediate objects and unreferenced objects comprises deleting DOM elements, packages and variables.
4. A terminal comprising a processor, an input device, an output device and a memory, the processor, the input device, the output device and the memory being interconnected, the memory being for storing a computer program, the computer program comprising program instructions, the processor being configured to invoke the program instructions to perform a memory release method according to any of claims 1-3.
5. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform a memory release method according to any of claims 1-3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910884819.1A CN110597738B (en) | 2019-09-19 | 2019-09-19 | Memory release method, terminal and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910884819.1A CN110597738B (en) | 2019-09-19 | 2019-09-19 | Memory release method, terminal and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110597738A CN110597738A (en) | 2019-12-20 |
CN110597738B true CN110597738B (en) | 2023-09-12 |
Family
ID=68861300
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910884819.1A Active CN110597738B (en) | 2019-09-19 | 2019-09-19 | Memory release method, terminal and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110597738B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111258926B (en) * | 2020-02-26 | 2022-06-10 | 腾讯科技(深圳)有限公司 | Memory recovery method and device, storage medium and computer equipment |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102368258A (en) * | 2011-09-30 | 2012-03-07 | 广州市动景计算机科技有限公司 | Webpage page caching management method and system |
CN102981845A (en) * | 2012-11-13 | 2013-03-20 | 北京奇虎科技有限公司 | Page elements processing method of browser and page elements processing device of browser |
CN103279541A (en) * | 2013-06-04 | 2013-09-04 | 天津市天安怡和信息技术有限公司 | Method and device for reducing web browser load |
CN103838771A (en) * | 2012-11-26 | 2014-06-04 | 腾讯科技(深圳)有限公司 | Browser page data processing method and device and browser |
CN103902581A (en) * | 2012-12-28 | 2014-07-02 | 腾讯科技(深圳)有限公司 | Method and device for removing DOM (document object model) nodes of pages |
CN104572950A (en) * | 2014-12-30 | 2015-04-29 | 乐视致新电子科技(天津)有限公司 | Memory release method for browser client and browser client |
CN108038134A (en) * | 2017-11-20 | 2018-05-15 | 东软集团股份有限公司 | The method, apparatus and storage medium and electronic equipment of page presentation |
US10101910B1 (en) * | 2015-09-15 | 2018-10-16 | Amazon Technologies, Inc. | Adaptive maximum limit for out-of-memory-protected web browser processes on systems using a low memory manager |
CN109213950A (en) * | 2017-06-30 | 2019-01-15 | 中国电信股份有限公司 | The data processing method and device of IPTV Intelligent set top box browser application |
CN109460253A (en) * | 2018-11-12 | 2019-03-12 | 郑州云海信息技术有限公司 | The method and device of system file Version Control is realized based on iframe |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7469324B2 (en) * | 2005-01-07 | 2008-12-23 | Azul Systems, Inc. | System and method for concurrent compacting self pacing garbage collection using loaded value and access barriers |
US7849437B2 (en) * | 2005-09-01 | 2010-12-07 | Microsoft Corporation | Object oriented web application framework |
US10565293B2 (en) * | 2014-08-26 | 2020-02-18 | Adobe Inc. | Synchronizing DOM element references |
-
2019
- 2019-09-19 CN CN201910884819.1A patent/CN110597738B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102368258A (en) * | 2011-09-30 | 2012-03-07 | 广州市动景计算机科技有限公司 | Webpage page caching management method and system |
CN102981845A (en) * | 2012-11-13 | 2013-03-20 | 北京奇虎科技有限公司 | Page elements processing method of browser and page elements processing device of browser |
CN103838771A (en) * | 2012-11-26 | 2014-06-04 | 腾讯科技(深圳)有限公司 | Browser page data processing method and device and browser |
CN103902581A (en) * | 2012-12-28 | 2014-07-02 | 腾讯科技(深圳)有限公司 | Method and device for removing DOM (document object model) nodes of pages |
CN103279541A (en) * | 2013-06-04 | 2013-09-04 | 天津市天安怡和信息技术有限公司 | Method and device for reducing web browser load |
CN104572950A (en) * | 2014-12-30 | 2015-04-29 | 乐视致新电子科技(天津)有限公司 | Memory release method for browser client and browser client |
US10101910B1 (en) * | 2015-09-15 | 2018-10-16 | Amazon Technologies, Inc. | Adaptive maximum limit for out-of-memory-protected web browser processes on systems using a low memory manager |
CN109213950A (en) * | 2017-06-30 | 2019-01-15 | 中国电信股份有限公司 | The data processing method and device of IPTV Intelligent set top box browser application |
CN108038134A (en) * | 2017-11-20 | 2018-05-15 | 东软集团股份有限公司 | The method, apparatus and storage medium and electronic equipment of page presentation |
CN109460253A (en) * | 2018-11-12 | 2019-03-12 | 郑州云海信息技术有限公司 | The method and device of system file Version Control is realized based on iframe |
Non-Patent Citations (1)
Title |
---|
让Firefox最小化时释放占用的内存;dream;《电脑迷》;20060531(第09期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110597738A (en) | 2019-12-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107766532A (en) | A kind of front end Node.js automates positive static method | |
CN102662600B (en) | Method for mutually dragging files at different domain names | |
CN107562425A (en) | Single-page application creation method and device based on Hybrid applications | |
CN111443901B (en) | Java reflection-based service expansion method and device | |
CN103761136A (en) | Method for dynamically loading data model based on plug-in | |
CN109445773A (en) | A kind of language based on programming promotes the method and electronic equipment of browser performance | |
CN110597738B (en) | Memory release method, terminal and computer readable storage medium | |
CN104731606B (en) | The system and method for Enterprise information integration management is realized based on identification crawl technology | |
CN101937335A (en) | Method for generating Widget icon, method for generating Widget summary document and Widget engine | |
CN116339694B (en) | Extension method and device of low-code platform assembly, electronic equipment and storage medium | |
CN108491209A (en) | The extracting method and device of common code in a kind of html pages | |
CN103117892B (en) | Add method and the device of website visiting record | |
CN106293658A (en) | A kind of interface assembly generates method and equipment thereof | |
CN104504125A (en) | Web page data monitoring method and device | |
CN107608664A (en) | A kind of method that mass data is loaded using zTree | |
CN103927301B (en) | A kind of method and device of utilization theme bag dynamic translation entry | |
CN105279195B (en) | The method and device of web application calling browser function | |
CN106991144B (en) | Method and system for customizing data crawling workflow | |
CN102567366A (en) | Method for realizing webpage resetting | |
CN109558579A (en) | A kind of report form generation method and device | |
CN103914481B (en) | Date storage method and device | |
CN111124386B (en) | Animation event processing method, device, equipment and storage medium based on Unity | |
CN105488054B (en) | A kind of method and device of browsing pictures | |
CN103399752A (en) | Mobile phone application chain reaction system and method based on Internet service | |
CN113111111A (en) | Multi-data source database access method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |