Permalink
Browse files

prevent memory leaks

  • Loading branch information...
indutny committed Dec 27, 2010
1 parent f559a70 commit b0d23f5b8a17e2394e5312c921212b58788ed617
Showing with 9 additions and 0 deletions.
  1. +9 −0 share/www/script/jquery.couch.js
@@ -29,6 +29,15 @@
onprogress(xhr.responseText.substr(lastPos));
lastPos = xhr.responseText.length;
+
+ // Prevent memory leaks (b/c xhr buffer is not cleaning)
+ if (xhr.responseText.length > (options.bufferLimit || 64000)) {
+ try {
+ xhr.abort();
+ } catch (e) {
+ }
+ options.success({});
+ }
}
return _onreadystatechange.apply(this, arguments);

0 comments on commit b0d23f5

Please sign in to comment.