Memory retention using jQuery ajax
Hi there,
I have some code that appears to cause memory to be retained by the browser. I have observed this memory retention in Safari, the nightly WebKit build and also Firefox; all using the latest versions of jQuery and the browsers themselves.
The code performs a query and then queues up another query to be performed (I'm using a polling-consumer pattern on my backend-resource).
- // Perform the Ajax request and handle failures.
- FidsDataController.getFids = function(dataController) {
- dataController.getFids();
- };
- FidsDataController.prototype.getFids = function() {
- var self = this;
- $.ajax({
- url: self.url,
- dataType: "xml",
- ifModified: true,
- timeout: self.timeout,
- success: function(data){
- self.updateFidsTables(data);
- self.lastDataReceived = data;
- setTimeout(FidsDataController.getFids, 100, self);
- },
- error: function(XMLHttpRequest, textStatus, errorThrown) {
- // If we've previously received data then ensure that the tables continue
- // to be updated.
- if (self.lastDataReceived !== null) {
- self.updateFidsTables(self.lastDataReceived);
- }
-
- setTimeout(FidsDataController.getFids, 5000, self);
- }
- });
- };
Any ideas?
Kind regards,
Christopher