Skip to content

Instantly share code, notes, and snippets.

@timrwood
Created June 5, 2013 00:05
Show Gist options
  • Save timrwood/5710669 to your computer and use it in GitHub Desktop.
Save timrwood/5710669 to your computer and use it in GitHub Desktop.
(function () {
function Server(){
this.clients = [];
}
Server.prototype.spawn = function () {
var i;
for (i = 0; i < 100000; i++) {
this.clients.push(new Client(this));
}
}
Server.prototype.dump = function () {
this.clients = [];
}
Server.prototype.dump = function () {
while (this.clients.length) {
this.clients.pop().server = null;
}
}
function Client(server) {
this.server = server;
}
var server = new Server();
setTimeout(function () {
server.spawn();
}, 1000);
setTimeout(function () {
server.dump();
}, 2000);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment