Easy: add it to something that's alive while the site is alive. Here's an example that leaks some memory every 100ms while you have the site open:
window.leakyArr = [];
function leakStuff() {
leakyArr.push("This is leaked" + Math.random());
}
setInterval(leakStuff, 100);
Of course if you unload the page this will all be collected. But if you have a page you leave open for a long time and it does stuff like this, it's possible for the page to use hundreds of megabytes of RAM. In fact, twitter does just that if you leave it open for a day or three, for reasons more or less like the above: they're showing or caching all the stuff that came in since you opened the page. That's more and more stuff as time goes on.