Closed cowboyd closed 8 years ago
I was thinking that for these memory tests along with the threading tests and the fiber tests we have yet to write, it would be nice to have some harness where we can shell out the content of a test to a script. That way if the script segfaults (which happens a lot with these tests) it won't kill the whole test run.
Also, when people come across a segfault or a memory leak, they often submit a freeform script as a reproduction. It would be nice to just roll this right into the test suite.
Hahahaha, I had no idea such a thing was even possible. Still, I wonder about the wisdom of it :)
This adds back the memory tests which ensure The Ruby Racer's stability. It also includes the changes needed to make these initial specs pass.
It disallows calling
Dispose()
directly on the underlying Isolate. If you do, then you could have all of the Ruby objects happily sitting in memory, but trying to use them would result in a segfault for trying to use a dead isolate. In order to avoid that, we'd have to put in safeguards everywhere to make sure for any operation on any context or object, that it's isolate was still alive.In order to reduce the complexity of memory management, the safest thing is to let the garbage collection hook dispose of the isolate itself. That way there is no doubt that the isolate is no longer in use.