From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#9273: 23.3; malloc initialization should (sometimes) happen at runtime Date: Thu, 11 Aug 2011 17:45:41 -0400 Message-ID: <4E444D85.4090907@cornell.edu> References: <4E41940C.2010605@cornell.edu> <83zkjhxnty.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1313099212 26313 80.91.229.12 (11 Aug 2011 21:46:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2011 21:46:52 +0000 (UTC) Cc: "9273@debbugs.gnu.org" <9273@debbugs.gnu.org> To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 11 23:46:46 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qrd5S-0007df-Br for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Aug 2011 23:46:46 +0200 Original-Received: from localhost ([::1]:47830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrd5R-0002V8-US for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Aug 2011 17:46:45 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrd5P-0002Un-85 for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2011 17:46:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qrd5N-0007ni-Ah for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2011 17:46:43 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qrd5N-0007nb-5T for bug-gnu-emacs@gnu.org; Thu, 11 Aug 2011 17:46:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Qrd6f-0002Fe-SP; Thu, 11 Aug 2011 17:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Aug 2011 21:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9273 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9273-submit@debbugs.gnu.org id=B9273.13130992438601 (code B ref 9273); Thu, 11 Aug 2011 21:48:01 +0000 Original-Received: (at 9273) by debbugs.gnu.org; 11 Aug 2011 21:47:23 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qrd62-0002Eg-SC for submit@debbugs.gnu.org; Thu, 11 Aug 2011 17:47:23 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141] helo=authusersmtp.mail.cornell.edu) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qrd60-0002ET-2I for 9273@debbugs.gnu.org; Thu, 11 Aug 2011 17:47:21 -0400 Original-Received: from [192.168.1.4] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id p7BLjvTR013865 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 11 Aug 2011 17:45:58 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <83zkjhxnty.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 11 Aug 2011 17:48:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:50015 Archived-At: On 8/10/2011 11:56 AM, Eli Zaretskii wrote: >> Date: Tue, 09 Aug 2011 16:09:48 -0400 >> From: Ken Brown >> I made one naive attempt to do this, but it didn't work (and it was >> Cygwin specific). Namely, I made unexec (for Cygwin) set >> _malloc_initialized = 0 before dumping. The resulting emacs aborted >> as soon as it was started. I haven't figured out what went wrong, >> but I'm not sure that's the right answer anyway. The problem was that realloc got called on memory that had been allocated prior to dumping, and the malloc information that was used then had disappeared. I think there's an obvious solution to this. At the time of reinitialization, we save the previous malloc state. Then if realloc is called on a pointer to something in the static heap, we temporarily restore the old state and let realloc proceed as it did in temacs prior to dumping. Unless I've (again) missed something obvious, it shouldn't be too hard to do this. I'm about to go on vacation, but I should have a patch ready within a couple weeks. Ken