If they were all assigned in the global scope, and you don't need to check iframe / window borders, and you don't need to do this in IE (for example, you're just trying to debug something), you should be able to iterate over the global scope:
var fooObjects = []; for(var key in window) { var value = window[key]; if (value instanceof foo) {
Buuuuut you probably have some kind of functions created inside functions somewhere, in which case they are not available.
You can try changing the constructor before instantiating:
var fooObjects = []; var oldFoo = window.foo; window.foo = function() { fooObjects.push(this); return oldFoo.apply(this, arguments); } foo.prototype = oldFoo.prototype;
source share