Permalink
Browse files

Limit the preload array.

I've seen browsers poop out after a large album with slideshow
enabled. Limiting the preload array seems to help, and makes
sense, since the amount of images in memory will radically
grow if left unattended.
  • Loading branch information...
sofar committed Oct 15, 2012
1 parent 06a63e0 commit bb18ab7889c89538eeee21dd4e9701c70ad02fa9
Showing with 2 additions and 0 deletions.
  1. +2 −0 album.js
View
@@ -83,6 +83,8 @@ function imgurl(a, i, size) {
}
function preload(a, i, size) {
+ if (preloads.length > 100)
+ preloads.splice(0, 50);
preloads[preloads.length] = new Image();
preloads[preloads.length - 1].src = imgurl(a, i, size);
}

0 comments on commit bb18ab7

Please sign in to comment.