public inbox for edbrowse-dev@edbrowse.org
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] suggest increasing the size argument to JS_NewRuntime
Date: Fri, 07 Feb 2014 05:13:12 -0800	[thread overview]
Message-ID: <874n4bgj6f.fsf@mushroom.PK5001Z> (raw)
In-Reply-To: <20140107013051.eklhad@comcast.net> (Karl Dahlke's message of "Fri, 07 Feb 2014 01:30:51 -0500")

Karl Dahlke <eklhad@comcast.net> 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

  parent reply	other threads:[~ UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
 Karl Dahlke
 ` Adam Thompson
 ` Chris Brannon [this message]
   ` Adam Thompson
  -- strict thread matches above, loose matches on Subject: below --
 Chris Brannon
 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874n4bgj6f.fsf@mushroom.PK5001Z \
    --to=chris@the-brannons.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).