rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: Chet Ramey <chet@odin.INS.CWRU.Edu>
To: schwartz@groucho.cs.psu.edu
Cc: rc@hawkwind.utcs.toronto.edu, chet@odin.INS.CWRU.Edu
Subject: Re: memory leaks
Date: Thu, 13 Aug 1992 09:34:59 -0400	[thread overview]
Message-ID: <9208131334.AA02378.SM@odin.INS.CWRU.Edu> (raw)
In-Reply-To: Message from schwartz@groucho.cs.psu.edu of Wed, 12 Aug 1992 22:08:12 -0400

> Is anyone (besides me) concerned about the memory leaks in rc1.4?  If
> you hit ^C you can watch your process size go up.  Depressing.  What do
> other shells do about this?

Bash has a fairly nice `unwind-protect' mechanism.  The interrupt handler
runs the unwind-protect list.  Bash is full of calls like

	begin_unwind_frame("tag");
	add_unwind_protect(free, string1);
	add_unwind_protect(close, openfd);
	add_unwind_protect (restore_signal_mask, oset);

		...

	run_unwind_frame("tag");

Look in the source file `unwind_prot.c' in the bash distribution.

ash and sh have a mechanism to `mark the stack' when allocating memory.
Then when they want to free it, they just unwind back to the previous
mark.

Chet

--
``The use of history as therapy means the corruption of history as history.''
	-- Arthur Schlesinger

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu


             reply	other threads:[~1992-08-13 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-08-13 13:34 Chet Ramey [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-08-13  3:44 Byron Rakitzis
1992-08-13  7:28 ` Scott Schwartz
1992-08-13  2:08 Scott Schwartz
1992-08-13  4:32 ` John Mackin
1992-08-13  7:56   ` Scott Schwartz
1992-08-13 10:30     ` Mark-Jason Dominus

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=9208131334.AA02378.SM@odin.INS.CWRU.Edu \
    --to=chet@odin.ins.cwru.edu \
    --cc=chet@po.CWRU.Edu \
    --cc=rc@hawkwind.utcs.toronto.edu \
    --cc=schwartz@groucho.cs.psu.edu \
    /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).