From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from deleted buffers, windows and frames. Date: Thu, 06 Sep 2012 10:55:12 +0400 Message-ID: <504848D0.4020908@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1346914525 323 80.91.229.3 (6 Sep 2012 06:55:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Sep 2012 06:55:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 06 08:55:24 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T9Vzn-0005il-1y for ged-emacs-devel@m.gmane.org; Thu, 06 Sep 2012 08:55:23 +0200 Original-Received: from localhost ([::1]:36844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Vzj-0008GV-Pv for ged-emacs-devel@m.gmane.org; Thu, 06 Sep 2012 02:55:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Vzg-0008GM-OY for emacs-devel@gnu.org; Thu, 06 Sep 2012 02:55:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9Vzf-0001Jx-EU for emacs-devel@gnu.org; Thu, 06 Sep 2012 02:55:16 -0400 Original-Received: from forward10.mail.yandex.net ([77.88.61.49]:41990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Vze-0001Gt-SD for emacs-devel@gnu.org; Thu, 06 Sep 2012 02:55:15 -0400 Original-Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward10.mail.yandex.net (Yandex) with ESMTP id 6604E10215C1; Thu, 6 Sep 2012 10:55:12 +0400 (MSK) Original-Received: from smtp6.mail.yandex.net (localhost [127.0.0.1]) by smtp6.mail.yandex.net (Yandex) with ESMTP id 416B7164012C; Thu, 6 Sep 2012 10:55:12 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp6.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tB3CSoDE-tC3mjt67; Thu, 6 Sep 2012 10:55:12 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1346914512; bh=dI0AXv7rLoV3lsBM+HlNJY3VUJ594Rp7wIasODdobS8=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Akb1tRChxUgvVTLynXTK4c4x9ubl68Sv9NangurKjzPoBowYWJfUV+pcpTmMCV4Ui LF34emZRAoKUAby8recfkpqDAS04ATiUimEGAAZrOH37CRtMHQuMT5lhkVU2d5q+O1 5JN+Dm4hpiRoEf0sPrd8+xFywLPiFVKJ/YKPu1KA= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 77.88.61.49 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153089 Archived-At: On 09/05/2012 10:24 PM, Stefan Monnier wrote: > I'm not sure this is safe. Such deleted objects are still perfectly > live from the memory-allocation point of view, and while some operations > on them are disallowed "for ever", there are others that might still be > permitted and which may still access internal data. IMHO such an operations shouldn't make any assumptions about internal fields of the deleted objects. The only possible exception is NILP (obj->field) since this may be used to distinguish between live and dead objects (as we have now for the buffers and windows). > E.g. you might still be able to get (window|frame)-parameters of > a deleted (window|frame). I'm pretty sure that this is invalid and should be fixed. The only important exception is saving/restoring window configurations. Strictly speaking, if the window configuration is recorded in saved_window_data, such a window is not deleted. Ideally, struct window should have a bit indicating that it's configuration is recorded so such a window can be distinguished from the really dead windows; but this requires a kind of finalization for saved_window_data objects (when such an object dies, it's finalizer should clear corresponding bits in all recorded windows). Since we can't implement this just now, I'm reverting window marking; but I think that I'll spent more time on this :-). > IOW, it adds lines of code, makes the invariants more complex (in ways > which I'm not sure is currently ensured by the rest of the code) and the > benefits aren't obvious at all. Hm. For example, killed buffers may sit in all_buffers for a while, and still have from tens to thousands reachable objects per buffer (although I didn't check whether these objects are reachable only from this dead buffer). > I don't think scanning those objects can take a noticeable amount of > time, so the only potential issue is holding on to data that can never > be used again, in which case I'd much prefer changing > kill-buffer/delete-(window|frame) so they set the various fields to > NULL/nil. Which is a much safer change. I agree about the safety, but: 1) this is slower; 2) IMHO this is conceptually wrong and 3) it still has it's own traps (for example, if we set all Lisp_Objects slot of the deleted window to Qnil, set-window-configuration will not work since it assumes that the restored window has valid marker objects at W->start and W->pointm). Dmitry