A kind of internal memory optimization method of using based on the RIA of industrial monitoring system
Technical field
The present invention relates to a kind of internal memory optimization technology, particularly a kind of method of internal memory optimization of the rich internet that is used for industrial monitoring system.
Background technology
RIA (Rich Internet Applications) rich internet is used the browser end program that belongs to the B/S mode configuration, characteristics are that development and maintenance is convenient, cost is low and are low to server requirement, in business system, be used widely, shortcoming is to be difficult to guarantee long-term, stable and operation reliably, has brought very big challenge for it is applied in industrial monitoring system.
The flow process of traditional browser end program is as follows:
1, by behind the browser login web server, initialization also shows main interface;
2, main interface comprises menu and Shipping Options Page assembly, clicks menu and opens sub-interface;
3, the browser end program is a sub-interface dynamic assigning memory behind the click menu, asks sub-interface desired data, shows behind the initial beggar interface;
4, information is operated or is checked at user's antithetical phrase interface;
5, click the X button at sub-interface behind user's complete operation, trigger sub-interface close event, destroy sub-interface, discharge the internal memory that it takies.
In the said process, because some characteristics of JavaScript and DOM, tend to cause memory overflow, open and close that memory overflow adds up in the cyclic process at sub-interface, cause it steady in a long-term not move, final browser collapse, general solution are the people for restarting browser, but this is definitely unallowed in the industrial monitoring field.
Summary of the invention
The present invention be directed to the deficiency of prior art existence, a kind of memory overflow that can effectively prevent browser end RIA application program is provided, to satisfy the internal memory optimization method of uninterrupted monitoring, long-term stability, reliability service requirement.
For achieving the above object, the technical solution used in the present invention is: a kind of internal memory optimization method of using based on the RIA of industrial monitoring system is provided, it is characterized in that may further comprise the steps:
(1) through browser login web server, initialization and main load interface and default sub-interface once are that required memory is distributed at main interface and default sub-interface;
(2) judge whether that new sub-interface opens request, if execution in step (3) is arranged, if execution in step (5) then not;
(3) judge whether sub-interface shows,, directly jump to sub-interface if show; If do not show, judge then whether this sub-interface has been arranged in the internal memory, if in the internal memory this sub-interface is arranged, then be its loading data, initialization also shows; If this sub-interface not in the internal memory then be its storage allocation, be written into data after generating new sub-interface, initialization is demonstration also;
(4) built-in function is carried out at user's antithetical phrase interface, returns step (2);
(5) judged whether to close the request of sub-interface,, then triggered sub-interface close event, hidden sub-interface, and do not destroy this sub-interface, returned step (2) if having if there is not execution in step (6);
(6) judged whether to close the request of main interface,, then finished internal memory optimization if having if then do not return step (2).
Described main interface comprises menu and Shipping Options Page assembly.
The present invention compared with prior art, technical solution of the present invention is owing to only create once at each sub-interface of optimizing the whole process in back, when creating behind the storage allocation, no longer be assembly application and releasing memory, therefore, its advantage is: no matter open and close sub-interface how many times, EMS memory occupation is all constant, this has just been avoided the dynamic application and the release of internal memory, thereby has effectively avoided memory overflow, can realize the steady in a long-term reliability service of RIA in industrial monitoring system.
Description of drawings
Fig. 1 is the process flow diagram based on the internal memory optimization method of the RIA application of industrial monitoring system that the embodiment of the invention provides.
Embodiment
Below in conjunction with drawings and Examples the present invention is further described.
Embodiment one
The browser end program is generally single web page program, promptly realizes the function of total system on a webpage.A webpage inside is by the demonstration of layout realization state, menu, main viewing area and function button etc.Can make things convenient for the sub-interface of global administration like this, to server requirement still less, server only is required to be browser data necessary is provided than conventional web is powerful to make the browser end program function, uses page generation and the tasks such as displaying, request of data finished by RIA.
Referring to shown in Figure 1, in the process flow diagram of provide at present embodiment one the internal memory optimization method of using based on the RIA of industrial monitoring system as can be seen, technical scheme of the present invention is at first by the browser logon server, only main interface and default sub-interface storage allocation space, main load interface and default sub-interface when program brings into operation.
Program judges whether that new sub-interface opens request, and if had according to sub-interface identification in internal memory the viewing area search sub-interface, just jump to this sub-interface if found;
If do not find continuation in internal memory not the viewing area search sub-interface, if found the show state with regard to the bundle interface to change " demonstration " into, loading data also shows;
If still do not find in internal memory with regard to storage allocation, newly-built sub-interface is provided with show state for " demonstration ", puts into viewing area, and loading data also shows;
When the program judgement had the turn-off request at sub-interface, the show state mark at bundle interface changed " hiding " into, puts into not viewing area, and showed that no longer sub-interface is not destroyed, and internal memory does not discharge yet.
Prioritization scheme provided by the present invention, its sub-interface is kept in the internal memory once just creating always, and just state and data change, and do not have establishment again and destroy application repeatedly and the release that does not also just have internal memory.Owing to do not have the application repeatedly and the release of internal memory, through operation and operation for a long time, EMS memory occupation can obviously not increase, thereby guarantees the reliability service steady in a long-term of industrial monitoring system.Because the assembly of industrial monitoring system can be not too many, and the applicable internal memory of institute is all very big, far more than required memory, therefore, can once be all sub-interface storage allocations.
Industrial monitoring system requires very high to real-time, this method just shows it when needing a sub-interface from internal memory, and speed improves greatly, meets the requirement of industrial monitoring system.
The present invention hides with assembly the browser end program of this industrial monitoring system and replaces the destruction technology, the repeatedly release and the distribution of internal memory when avoiding repeatedly the closing and open of assembly, thus effectively having avoided the internal memory leakage, it is more reliable and more stable that RIA is used.