From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (unknown [IPv6:2602:4b:a4d8:4b00:12bf:48ff:fe7c:5584]) by hurricane.the-brannons.com (Postfix) with ESMTPSA id 69DA77842B for ; Fri, 7 Feb 2014 05:13:47 -0800 (PST) From: Chris Brannon To: Edbrowse-dev@lists.the-brannons.com References: <20140107013051.eklhad@comcast.net> Date: Fri, 07 Feb 2014 05:13:12 -0800 In-Reply-To: <20140107013051.eklhad@comcast.net> (Karl Dahlke's message of "Fri, 07 Feb 2014 01:30:51 -0500") Message-ID: <874n4bgj6f.fsf@mushroom.PK5001Z> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Edbrowse-dev] suggest increasing the size argument to JS_NewRuntime X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 13:13:47 -0000 Karl Dahlke 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