Memory retention using jQuery ajax

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).

  1. // Perform the Ajax request and handle failures.
  2. FidsDataController.getFids = function(dataController) {
  3. dataController.getFids();
  4. };

  5. FidsDataController.prototype.getFids = function() {
  6. var self = this;

  7. $.ajax({
  8. url: self.url,
  9. dataType: "xml",
  10. ifModified: true,
  11. timeout: self.timeout,
  12. success: function(data){
  13. self.updateFidsTables(data);
  14. self.lastDataReceived = data;

  15. setTimeout(FidsDataController.getFids, 100, self);
  16. },
  17. error: function(XMLHttpRequest, textStatus, errorThrown) {
  18. // If we've previously received data then ensure that the tables continue
  19. // to be updated.
  20. if (self.lastDataReceived !== null) {
  21. self.updateFidsTables(self.lastDataReceived);
  22. }
  23. setTimeout(FidsDataController.getFids, 5000, self);
  24. }
  25. });
  26. };
Any ideas?

Kind regards,
Christopher