Skip to content

Instantly share code, notes, and snippets.

@mixu
Created September 11, 2012 20:40
Show Gist options
  • Save mixu/3701854 to your computer and use it in GitHub Desktop.
Save mixu/3701854 to your computer and use it in GitHub Desktop.
var i = 0;
function fillLocalStorage(size) {
try {
window.localStorage.setItem('data'+i++, new Array(size).join('a'));
} catch(e) {
if(size == 1) {
throw e;
} else {
return fillLocalStorage(Math.floor(size / 2));
}
}
console.log('Added ' + size);
fillLocalStorage(size);
}
fillLocalStorage(1024 * 1024);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment