The cause of the problem is this. Everytime we pass a new object (IE an item or character) to the JS engine, we must create a JSObject for it. This is done quite well in our events, as we allocate some memory once at script creation, and then re-use those entries in every event call. However when an object method or property, or JS function allocates an object, we have no good method of de-allocation. Thus when we call something like obj.owner, it allocates that memory, but never releases it after the script has fired.
The root of the problem is a lack of any good way to track our JSObjects. This is largely because the JSObjects are divided up among scripts, of which there are hundreds, and could be thousands of. This method of implementation, however, was not the intent of the Spidermonkey authors.

As you can see by this graph, the idea is that JSObjects are created by a general handler for that Runtime, and then each individual context and script can make use of them.
Thus I think we should create a new class that will house all of our JSObjects, ensuring that we have at a maximum only one per real object (so we don't have 1 item with 10 JS Objects attached to it). Moreover, this class must have an improved way to track these objects so we can call some type of general release function as soon as the object is no longer in use by any script.
Thoughts, suggestions, ideas, etc are welcome.[/img]