As we all know, with ext, we can save art. But this morning, a customer suddenly said that our product occupies a very high browser resource, and a page even reaches 300 MB-1000 MB until the memory is full. At first, I thought that the browser had visited other pages and the resources were not released in time. After I went in and tested it myself, I found that every time I clicked a window implemented using Ext, the memory usage will increase by 50 MB. At that time, I was amazed to say to myself: "No".
After the problem is found, analyze it. The first step is to find the cause on the page, because the homepage isArticleThe page is displayed, so there is a lot of content, and it is suspected that this location causes ext problems. I found a page with very little page information and started the test. I found that the memory usage of the window related to click ext is very small. The detailed analysis and investigation later are very complicated and I have guessed it for a long time. I will not be so embarrassed, but I will explain the final reason.
If you are familiar with ext, ext. Window of ext has an attribute modal. You can set the form as a mode window. The effect is that all the background except the window turns dark, and other areas cannot be operated. Only the displayed window can be operated. Because of this attribute, the memory of each outbound window is increased by 50 MB, or even higher. I did a test on myself and found no content on a page. There was only one button, and I clicked to display Ext. window object, and then there are countless line feed labels "<br>" on the page to make the page longer. The amazing result is that every time a window is displayed, it will occupy more than 100 MB of memory. The more line breaks, that is, the longer the page, the larger the memory usage, it also accumulates continuously and will not be released until there is too much memory, and that special effect will go wrong.
"The larger the page area, the more memory occupied by the mode window. "If you haven't found any friends, please use them with caution. Now I have set all the modal attributes of the ext special effects of the project to false. This should also be a bug in Ext. I tested ext2.2 and hoped that the next version would solve the problem.
Below I will post my demo during the test. Let's take a look.
Http://files.cnblogs.com/dirain/extjs-bug.rar