edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Chris Brannon <chris@the-brannons.com>
To: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] memory error
Date: Sun, 23 Feb 2014 15:53:13 -0800	[thread overview]
Message-ID: <8738j95qty.fsf@mushroom.PK5001Z> (raw)
In-Reply-To: <20140223231606.GE15819@toaster.adamthompson.me.uk> (Adam Thompson's message of "Sun, 23 Feb 2014 23:16:06 +0000")

Adam Thompson <arthompson1990@gmail.com> writes:

> That's really annoying.   I've got nothing against taking actions based on the
> error number as (if I understand the mechanism correctly)
> this is dependant on the type of error.
> However, doing things based on the error message (which I think comes from
> exceptions, user thrown or otherwise) seems a bit more fragile to me.

It does come from an exception.  When out-of-memory is encountered
during script execution, this is converted to a JS exception.  If it
isn't caught, my_ErrorReporter sees it as "uncaught exception: out of
memory".

You're right.  Acting on the error message is fragile, and I don't like
it either.  On the other hand, I like propagating errors to unrelated
parts of the program even less.  Yes, there's a good chance that we'll
catch the error as soon as we call another JSAPI function, but I think
there's also a chance (however slight) that we won't.  E.G., suppose the
script throws the out of memory exception and a bunch of memory gets
reclaimed afterword.  This will probably lead to completely unrelated bugs in
the rest of the JavaScript executed in this context.
So it's a trade-off, and I vote for trying to catch the error as soon as
possible.

-- Chris

  reply	other threads:[~2014-02-23 23:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-23 22:57 Karl Dahlke
2014-02-23 23:16 ` Adam Thompson
2014-02-23 23:53   ` Chris Brannon [this message]
2014-02-24 10:25     ` Adam Thompson
2014-02-24  1:47 Karl Dahlke

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=8738j95qty.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 NNTP newsgroup(s).