Karl Dahlke <[email protected]> writes:

> Or maybe js returns 0, like any malloc failure,
> and I don't watch for that and then I segfault.

Yes, this is correct.  My wording was loose.  JS returns NULL somewhere
because of an out of memory condition, and the program eventually
segfaults because that NULL is passed along to a function that cannot
deal with it.
As you say, we need lots more error legs.  I think we've had that
discussion, and no one has written them yet.
So I'll get started on those today.

> But that doesn't explain why Chris simple program segfaults on debian js.

Yes, that's a different issue entirely. My program on Debian doesn't 
even make it past JS initialization.  It fails before it can even get a
JS context.

> My wrappers around malloc do indeed print and exit upon malloc failure,
> which probably saves me about 3,000 lines of error leg programming,

No, when Spidermonkey runs out of memory, the "out of memory" message is
printed via my_ErrorReporter() from jsdom.cpp.
E.G., try browsing http://the-brannons.com/array.html with db2.

We could write another set of wrappers for JS functions.  E.G.,
our_JS_NewObject, which causes an exit when JS_NewObject fails.

-- Chris
_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

Reply via email to