🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.epoch.misc
Article #1124

possible epoch memory leak fix

#1124
From: Marc Andreessen
Date: Fri, 27 Nov 1992 20:47
103 lines
3548 bytes
Following is an unofficial patch to Epoch 4.2 that purports to fix the
memory leak that occurs when a zone is deleted.  My tests show that it
seems to be working, but it's almost 5 in the morning and I'm feverish
with fatigue so don't take that for granted.

Let me know how it works (or doesn't, as the case may be)......

---------------------------------- CUT HERE ----------------------------------
*** alloc.c.orig	Wed Aug  5 03:18:33 1992
--- alloc.c	Sat Nov 28 04:33:52 1992
***************
*** 32,37 ****
--- 32,38 ----
  #ifndef standalone
  #include "buffer.h"
  #include "window.h"
+ #include "button.h" /* epoch */
  #endif
  
  #define max(A,B) ((A) > (B) ? (A) : (B))
***************
*** 1074,1080 ****
      case Lisp_Process:
      case Lisp_Window_Configuration:
      case Lisp_Root_Block:	/* Epoch */
-     case Lisp_Button:
      case Lisp_Style:
        {
  	register struct Lisp_Vector *ptr = XVECTOR (obj);
--- 1075,1080 ----
***************
*** 1085,1090 ****
--- 1085,1108 ----
  	ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */
  	for (i = 0; i < size; i++)     /* and then mark its elements */
  	  mark_object (&ptr->contents[i]);
+       }
+       break;
+ 
+     case Lisp_Button:
+       {
+ 	register struct Lisp_Vector *ptr = XVECTOR (obj);
+         register struct Lisp_Button *b = XBUTTON (obj);
+ 	register int size = ptr->size;
+ 	register int i;
+ 
+ 	if (size & ARRAY_MARK_FLAG) break;   /* Already marked */
+         /* If it's not dead meat, go ahead and mark it. */
+         if (NIL(b->dead_meat))
+           {
+             ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */
+             for (i = 0; i < size; i++)     /* and then mark its elements */
+               mark_object (&ptr->contents[i]);
+           }
        }
        break;
  
*** button.c.orig	Wed Aug  5 01:03:25 1992
--- button.c	Sat Nov 28 04:24:40 1992
***************
*** 792,797 ****
--- 792,799 ----
  	  unchain_marker(button->start);
  	  unchain_marker(button->end);
  	  button->prev = Qnil;
+           /* HACK here. */
+           button->dead_meat = Qt;
  	  buttons = button->next;
  	  button->next = Qnil;
  	}
***************
*** 1010,1015 ****
--- 1012,1019 ----
    if (!bf) return button;	
  
    RemoveButtonFromBuffer(b,bf,1); /* remove and unchain markers */
+   b->dead_meat = Qt;
+   /* HACK here. */
    return button;
  }
  
*** button.h.orig	Wed Aug  5 01:03:26 1992
--- button.h	Sat Nov 28 04:23:41 1992
***************
*** 31,36 ****
--- 31,38 ----
    Lisp_Object read_only;
    /* flag - is button "transient" */
    Lisp_Object transient;
+   /* flag - is button dead meat */
+   Lisp_Object dead_meat;
  };
  
  struct Lisp_Style
---------------------------------- CUT HERE ----------------------------------

Marc

--
Marc Andreessen
Software Development Group
National Center for Supercomputing Applications
marca@ncsa.uiuc.edu
Technical Details
Message-ID: <9211281247.AA09906@wintermute.ncsa.uiuc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marca

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc7ee,1be934bdb162aed9,start
X-Google-Attributes: gidfc7ee,public
X-Google-ArrivalTime: 1992-11-28 04:32:13 PST
Newsgroups: gnu.epoch.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marca
From: marca@ncsa.uiuc.edu (Marc Andreessen)
Subject: possible epoch memory leak fix
Message-ID: <9211281247.AA09906@wintermute.ncsa.uiuc.edu>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 27 Nov 1992 20:47:29 GMT
Lines: 104