I am using javascript to load and parse a big xml file (around 1 mb) save some values to an array and draw a picture using google Flot. Unfortunately, this causes the browser to crash! Is there a way to clear the memory of the browser?
I have a code for the keydown event: -when you press the UpArrow key the image moves up -when you press the DownArrow key the image moves down.....and so on But don't forget that this is under the keydown event...so when I keep pressing the UpArrow key the image moves up but when I release the key the image still moves up. I already put the code $('myImage').stop(); on my image on keyup event but this doesn't do anything. There is a code to clear my memory from pressed keys or something?
The following code is working fine in firefox n not working in IE8... I get the Object Expected Error when the code hits the if(GBrowserIsCompatible())..... line in the javascript code. Clear cache and browser history does not work. Does anyone have a resolution for this?
take a look at the below code. The below code is small representation of a bigger system.
HTML Code: <html> <head> <style type="text/css"> </style>
[Code]...
However the problem is that once the tabs/iframes are removed the browser does not release the memory. This happens both in IE8 and FireFox. So over a period of time the memory consumed by the browsers are huge because of the creation and deletion of new tabs/iframes and the application slows down. Is there a way to make the browser release memory when an iframe is removed.
OK, so I have an AJAX app and am using browser caching to reduce the number of server calls. However, I wanted to be able to clear the whole cache for the browser if the version of my AJAX app has changed.
My plan is to have the version number stored in a cookie on a user's machine. The first thing my app then does upon load is check the version number of the javascript to the version number of the cookie and if they are not the same clear the cache.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <script type="text/javascript"> function TextScroll(scrollname, div_name, up_name, down_name, top_name){ [Code]...
When I use mouse wheel in Firefox to scroll contents of the DIV, memory usage in Firefox goes through the roof. Code above is a fully working page, if anyone would like to see what's up, just load it up, and start moving your mouse wheel in the area with text. You don't actually have to scroll the text, just moving the wheel back and forth in that DIV will do. Memory usage will start going up quite fast, and after you stop moving the wheel, it will finally come down a bit after a short while. I've highlighted in red the line where mousewheel event is registered for Firefox. I'm not sure if it's really a problem, but since Opera and IE don't have any strange memory usage, and Firefox does, maybe I did something wrong. In everyday use it shouldn't matter [don't expect to have kilometers of content to scroll], but anyway, it is a bit unsettling.
I have a search form and added the "Clear All" Button functionality...but it clears the last part of the search form display preferences....how do I only clear the checkboxes at the top of the form only and not at the bottom of the form between the <DIV> tags? I have attached a copy of the JSP page.
I've been putting together a small pet project. Once it was finished i realised it had a gigantic memory leak inside of it. I tried to read up on the subject, but couldn't find the source of the problem via the articals.
This site is very simple, so I'd think idenifying (and hopefully fixing) the problem would be easy. Here is the relavent portions of JS (followed by links to the full page incase you need to see that): Code:
I was wondering how good is JavaScript with memory management. I have an object called MANAGER that has a list of other objects, each one managing a single DOM nodes, etc. In my implementation of MANAGER.reset(), I simply recreate my MANAGER.object_list = new object(); and do a single MANAGER.domnode.innerHTML = '' as apposed to getting my hands dirty. Is my app leaking memory?
Internet Explorer leaks memory when I update a div container using innerHTML, this does not occur in firefox. This would not be a problem except the webpage is required to be left on for weeks on end without being restarted. I presume the issue with innerHTML is that Internet Explorer apparently parses what you give it and then decides on how to construct the dom elements itself, so never truely creates what you give it.
I know that the innerHTML is the problem as I have successfully narrowed down the leak to that line. It only leaks memory when I assign content to the innerHTML of my containing DIV. Appending a text node, for example, with the exact same information to the same div does not leak. Note I have also tried using such existing AJAX packages like Prototype etc. but to no avail.
I need to do it this way as my XML documents are styled using an XSL stylesheet and then transformed using transformNode [I will omit details regarding firefox as there is no problem there]. I have looked into transformNodeToObject as a way to get a dom object that I originally assumed could be appended [as a child] to my containing element. This did not work and gave me compatibility errors.
I suppose I am either looking for someone who has solved this problem, or who has an acceptable work around. Or someone to say that it cannot be solved.
I am developing a simple image editor in an HTA (for a special use-case). Because it is an HTA, it runs in IE only (IE7 to be precise).
Everything is working great so far, however, because I am loading the same img src file over after every edit, I had to attach " + Math.random();" to the image src so that the updated image is displayed.
This has lead to some pretty severe memory issues, as each time I make an edit, it caches another image. Under normal operation, my app uses under 20MB with a single image loaded, however after every edit it adds about 3MB. After a few minutes of testing I have had it consuming over 200MB!
Is there another way to use the same file name, same image src, etc, but have the browser re-read the file before displaying it again rather than using a cached copy.
Alternately, is there a way to make the browser forget about the other copies it has in memory to keep memory usage under control.
I'm writing a very complex javascript application and I'd like memory usage to be as low as possible, so I've got a question about objects.
I'm using jQuery and my code is a bunch of jQuery plugins that interact with eachother. Will there be a difference in memory usage if I declare functions like this:
I haven't written anything in javascript as complex as I'm about to write, so I never worked with objects. As far as I understand, $.fn.whatever will add function to prototype, while $.whatever will add function only to one entry of jQuery object.
So question comes down to this: when jQuery object is being created, are functions in it being copied (meaning increase in memory usage) or does javascript only make references (meaning no significant increase in memory usage) to one main entry of that function in prototype?
Do the latest browsers still need this? I could find an article about IE8 which states that its garbage collection has improved so circular references shouldn't be a big problem any more.Reason for asking is that I maintain an JavaScript / AJAX framework and we are currently optimizing our code which contains a lot of code to remove references from and to the DOM and to remove event listeners.
What is the best way to prevent memory leaks in IE6 and IE7?
I'm working on an internal web app that just gets slower and slower, using more and more CPU load and memory, unless and until you close the browser and start, again.
I am a little confused how the memory for objects is allocated in JavaScript. David Flanagan, in "javascript: The Definitive Guide," states that each property of a class takes up memory space when instantiated. So space is created for aMethod three times in this example: Code:
I want to get the physical memory status, say, the total amount of physical memory, the free memory, and so on, from the javascript, is it a mission impossible?
It is possible to remove a function from the memory? I have a custom function that I call usingmodul.StepGuide.init() - but how do I remove that function with all its vars and events, from the memory.
is there a "javascript" way to enable cookie memory to whatever a user does. for example, if the user wants to edit something and then save it and the cookie will memorize it even if they clear cookies??
I'm designing a page to fade multiple images (three) in and out over a set period of time (one minute, say). The code I have works as follows:
I define an array and fill it with the div objects I want to fade in and out. I have some simple tags (2 for opaque, 1 for fading in, -1 for fading out, etc.) that I set to show the state of the object.
First I check if the object is opaque, and if so set it to fade along with a time;
Or if it's transparent I give it a 1 in 10 chance of fading in during this iteration. If it's currently fading in or out I check to make sure it's on track and change the opacity of the div accordingly.
Originally, I had the function call back to itself using setTimeout after the loop had gone through all the divs and changed their opacities appropriately. This caused an out of memory error (though, strangely, if I had any alerts in the function it didn't give me the error).
So the version below has the code in a while loop to let it run for 20 seconds - this gives me the "a script...run slowly, do you want to continue the script?" message.
So I have several questions:
1) First and foremost, why is my function causing out of memory/run slowly errors and what is the best way to fix that?
2) Is there a better way to code this effect (final result will be six lights fading in and out for a minute or so).
3)I'm not an experienced programmer, so any bad practices, ways to streamline, no no's, etc. that you see, please point out.
I've only posted the script here - the page simple consists of three divs (id's grad0, grad1, grad2) and a call to the function copied here.
I was thinking about doing a dynamic scrolling table. As the user scrolls down ajax loads in more rows to show. With the table I'm working on having the client load the whole thing would result in a page well north of 2 GB, so it isn't feasable.I will probably end up putting some logical limits - hold say 100 rows total with 20 or so visible.
I have a really long application so i'm trying to minimiza cpu/memory usage,with each function, therefore I have a few simple questions.
1. on elements added after the page has been loaded,is there a difference between putting "onclick" inside the element tag or using jquery's delegate like the following example?
2. does it make a big difference selecting an element with a full path like (#body #contentdiv #userstbl td.example)or just typing (.example) ?
3. I have 2 arrays of objects, both objects has an id attribute, one of then objects are the images on the page, the second one is an ajax result with updated images.will it be better to first loop threw both objects just to create new arrays with just the id's instead of looping the threw those big objects? like this:
Code: if (data.online) var online_length = data.online.length; else[code]..........
I have the AJAX-script. It eats memory about 4Kb per one callback. Script reflects messages from server application in real-time. I form messages, and put them into the iframe. If mesages more than 40 last message delete. Can you check the script and say about my mistakes? Code: