[comp.sys.mac.system] Killing the Finder to free up more RAM under Multifinder?

bskendig@phoenix.Princeton.EDU (Brian Kendig) (05/28/90)

My Mac SE has 2.5M of RAM, and I run Multifinder all the time.  It's a
great setup -- except for those times when I run out of memory.

The other day I needed to be able to open a word processor and a paint
program at the same time in order to cut 'n' paste parts of paint
files into the text.  Unfortunately, I had almost, but not quite,
enough memory to do it.  It occurred to me that the Finder was taking
up 360k of memory doing nothing, and that if I could kill it, I'd be
in business.  Unfortunately, no simple solutions presented themselves.

Is there any Apple-approved way to kill the Finder when its memory
would best be used by other programs?  Barring that, is there any
*kludge* to kill the Finder when its memory would best be used by
other programs?

If not, it's a crying shame.  Perhaps applications such as the Finder
could be made to give up memory when they're dormant (set aside) --
but with the way that the Mac manages memory, that won't work, now,
will it?  Pity.

     << Brian >>
-- 
| Brian S. Kendig      \ Macintosh |   Engineering,   | bskendig             |
| Computer Engineering |\ Thought  |  USS Enterprise  | @phoenix.Princeton.EDU
| Princeton University |_\ Police  | -= NCC-1701-D =- | @PUCC.BITNET         |
... s l o w l y,  s l o w l y,  w i t h  t h e  v e l o c i t y  o f  l o v e.

juh@cs.hut.fi (Juha Hyv|nen) (05/28/90)

In article <16797@phoenix.Princeton.EDU>bskendig@phoenix.Princeton.EDU
(Brian Kendig) writes:
+-------------
!   Is there any Apple-approved way to kill the Finder when its memory
!   would best be used by other programs?  Barring that, is there any
!   *kludge* to kill the Finder when its memory would best be used by
!   other programs?
+.............

Disclaimer:	I have *NOT* tried this. I saw it in the April 1990
		issue of MacWorld (Quick Tips, page 233).

Summary:	1. Make a backup copy of the Finder.
		2. Use ResEdit to make a FKEY resource with the (hex)
		   string A9F4 into the Finder.
		3. Remember to change the FKEY resource ID
		   to 5...9 or 0 (zero).
		4. Quit ResEdit (save the changes).

Of course, now you need an alternate method to launch programs.

	   / (.__o		..
	  /_/ __/	Juha Hyvonen
	! /  !
	!/ ) !		juh@cs.hut.fi
	 ------

nick@lfcs.ed.ac.uk (Nick Rothwell) (05/28/90)

In article <16797@phoenix.Princeton.EDU>, bskendig@phoenix (Brian Kendig) writes:
>Is there any Apple-approved way to kill the Finder when its memory
>would best be used by other programs?  Barring that, is there any
>*kludge* to kill the Finder when its memory would best be used by
>other programs?

I installed an ExitToShell FKEY in the Finder to blow it away when
I needed to (e.g. to free the Desktop file). It means you sometimes
get windows left in the old open/closed state, but I haven't had any
problems otherwise.

>     << Brian >>

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
		   Ich weiss jetzt was kein Engel weiss

momma@is.informatik.uni-stuttgart.de (Stefan Momma) (05/28/90)

In article <JUH.90May28095602@hutcs.hut.fi> juh@cs.hut.fi (Juha Hyv|nen) writes:

>   Disclaimer:	I have *NOT* tried this. I saw it in the April 1990
>		   issue of MacWorld (Quick Tips, page 233).
>   Summary:	1. Make a backup copy of the Finder.
>		   2. Use ResEdit to make a FKEY resource with the (hex)
>		      string A9F4 into the Finder.
>		   3. Remember to change the FKEY resource ID
>		      to 5...9 or 0 (zero).
>		   4. Quit ResEdit (save the changes).
>   Of course, now you need an alternate method to launch programs.



Like, for example, Launch. Version 3.0 just made it to
comp.binaries.mac Should also allow you to restart the finder
afterwards. (Haven't tried it, of course)


--

Stefan Momma               voicemail:+49-711-121-1431 (-3138) (secr.: -3125)
Projekt Polygloss          Internet:   momma@informatik.uni-stuttgart.dbp.de
IMS-CL/IfI-AIS             Because-It's-There-NET:         nbab1424@ds0rus54 
University of Stuttgart    ICBMnet :        48 46 36 N; 9 10 48 E; alt 245 m 
                           SnailNet/Sneakernet:             Keplerstrasse 17
                                   D-7000 Stuttgart 1;  Fed. Rep. of Germany

nick@lfcs.ed.ac.uk (Nick Rothwell) (05/28/90)

In article <JUH.90May28095602@hutcs.hut.fi>, juh@cs (Juha Hyv|nen) writes:
>Disclaimer:	I have *NOT* tried this. I saw it in the April 1990
>		issue of MacWorld (Quick Tips, page 233).
>
>Summary:	1. Make a backup copy of the Finder.
>		2. Use ResEdit to make a FKEY resource with the (hex)
>		   string A9F4 into the Finder.

This is the ExitToShell trap I mentioned earlier.

>		3. Remember to change the FKEY resource ID
>		   to 5...9 or 0 (zero).
>		4. Quit ResEdit (save the changes).
>
>Of course, now you need an alternate method to launch programs.

No you don't. You can quite happily blow away the Finder. When all
other applications finish (and that includes the DA Handler), the
Finder will be restarted (as will any "Set Startup" tasks; looks
like the Finder does these).

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
		   Ich weiss jetzt was kein Engel weiss

lewin@zariski.husc6 (Alex `Reaper' Lewin) (05/29/90)

The way that works for me is to switch to Finder (while another app is
running in MultiFinder), hit the programmer's switch, and do an
ExitToShell() from MacsBug, i.e., type "es".  This usually works (fails if
you happen to catch the Mac while it is SystemTask()ing I guess), and
doesn't require compiling anything.  I guess it's kind of a hack, but hey.

Alex Lewin
Harvard University

juh@cs.hut.fi (Juha Hyv|nen) (05/29/90)

In article <4275@castle.ed.ac.uk> nick@lfcs.ed.ac.uk (Nick Rothwell) writes:
+--------
!  In article <JUH.90May28095602@hutcs.hut.fi>, juh@cs (Juha Hyv|nen) writes:
!  >Of course, now you need an alternate method to launch programs.
!
!  No you don't. You can quite happily blow away the Finder. When all
!  other applications finish (and that includes the DA Handler), the
!  Finder will be restarted (as will any "Set Startup" tasks; looks
!  like the Finder does these).
+........

The original problem was to kill the Finder to be able to open more
applications. In order to do that, you do need an alternate method of
opening applications.


About the regained memory...

From April 1990 issue of MacWorld (Quick Tips, page 233, Lon Poole's
comments about the tip):

	" You'll also need to quit the application you opened before
	" quitting the Finder. Otherwise the regained memory can only
	" be used to open an application that needs no more memory than
	" the Finder. [...]

What does that mean? If I have the following setup:

About Finder box:

	Total Memory: 1024 K	Largest block:	64 K

	Appl A	300 K
	Finder	160 K
	System	500 K

Application B requires 200 K. If I quit the Finder can I launch B?

	   / (.__o		..
	  /_/ __/	Juha Hyvonen
	! /  !
	!/ ) !		juh@cs.hut.fi
	 ------

steve@uswmrg2.UUCP (Steve Martin) (05/29/90)

In article <LEWIN.90May29043654@zariski.husc6> lewin@zariski.husc6 (Alex `Reaper' Lewin) writes:
>
>The way that works for me is to switch to Finder (while another app is
>running in MultiFinder), hit the programmer's switch, and do an
>ExitToShell() from MacsBug, i.e., type "es".  This usually works (fails if
>you happen to catch the Mac while it is SystemTask()ing I guess), and
>doesn't require compiling anything.  I guess it's kind of a hack, but hey.

I tried the FKEY method discussed here and find that it works well.  It should
give the same results as this MacsBug method, but the FKEY will only be called
when the system is waiting for an Event, so there should be no possible problem
with interupting and interupt!

-- 
Steve Martin                         | Nothing I say can be held against
U S West Marketing Resources Group   | Me or my employer!
(...!rutgers!bellcore!uswat!uswmrg2!steve)

d88-jwa@nada.kth.se (Jon W{tte) (05/29/90)

In article <JUH.90May29144638@hutcs.hut.fi>, juh@cs.hut.fi (Juha
Hyv|nen) writes:

> About Finder box:
> 	Total Memory: 1024 K	Largest block:	64 K
						^^^^
> 	Appl A	300 K
> 	Finder	160 K
> 	System	500 K

> Application B requires 200 K. If I quit the Finder can I launch B?

No. You'd end up with two blocks - one 64K and one 160K. These can't be
recombined to one larger block, since the application blocks (heaps)
can't move.

Think of memory as one huge block. Now, everytime an application starts,
it will get as much of the lowest block that will contain it as it
wants. This memory is marked occupied until the application quits.

The Finder is normally opened first, and gets the bottom n k's (where
n should be > 160 for optimum performance, by the way)

The next opened application gets the next m k's and so forth.

Now, let's say you first launch Fidner, then A, then B, the heap would look
like this:

	--------------------------

		System Heap

	--------------------------

		Free Space

	--------------------------

		Application B

	--------------------------

		Application A

	--------------------------

		Finder

	--------------------------

If you quit the finder, you only regain the amount of memory it occupies in
one block; this can't be recombined with the other free memory.

If you later quit Application A, you'll get one larger block with the
space of the Finder and that of Application A combined, since they're
contiguous.

If you launch and quit many applications, in no particular order, it's
fully possible you could end up with three apps running, > 1 MB free, but
only 300 k as the largest block. This is called heap fragmentation.

(Note: "Heap" is here the global memory, not the system heap, nor any
particular Application heap. The system heap may expand downwards, by the way)


								h+

   ---  Stay alert !  -  Trust no one !  -  Keep your laser handy !  ---
             h+@nada.kth.se  ==  h+@proxxi.se  ==  Jon Watte
                    longer .sig available on request

nick@lfcs.ed.ac.uk (Nick Rothwell) (05/30/90)

In article <JUH.90May29144638@hutcs.hut.fi>, juh@cs (Juha Hyv|nen) writes:
>In article <4275@castle.ed.ac.uk> nick@lfcs.ed.ac.uk (Nick Rothwell) writes:
>!  No you don't. You can quite happily blow away the Finder. When all
>!  other applications finish (and that includes the DA Handler), the
>!  Finder will be restarted (as will any "Set Startup" tasks; looks
>!  like the Finder does these).
>
>The original problem was to kill the Finder to be able to open more
>applications. In order to do that, you do need an alternate method of
>opening applications.

Yes. Sorry. I misunderstood why you were trying to do this. I tend to
blow away the finder so I can edit its LAYO resource, for instance, or
to rebuild the Desktop file.

_Launch 3.0 seems to be a rather nice way of launching things without
the finder, and it's quite small.

>What does that mean? If I have the following setup:
>
>About Finder box:
>
>	Total Memory: 1024 K	Largest block:	64 K
>
>	Appl A	300 K
>	Finder	160 K
>	System	500 K
>
>Application B requires 200 K. If I quit the Finder can I launch B?

I suppose it depends on the order in which the applications are
arranged in memory. If the Finder is at the top (or is that the
bottom?), then hosing it might make room.

This is a guess; I don't know too much about the application heap
management.

		Nick.
--
Nick Rothwell,	Laboratory for Foundations of Computer Science, Edinburgh.
		nick@lfcs.ed.ac.uk    <Atlantic Ocean>!mcsun!ukc!lfcs!nick
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
		   Ich weiss jetzt was kein Engel weiss

bochner@endor.harvard.EDU (Harry Bochner) (05/31/90)

Last night I tried out the method described in the last few days of
installing an ExitToShell FKEY into the finder. That in itself worked
fine. I then tried starting _Launch 2.5 (out of date, I know) and a few
other programs, killing the finder, and restarting it with _Launch. The
finder started, opened its windows, but then got hung. I think it was
in HFSDispatch when it hung.

Any idea what went wrong? Will _Launch 3.0 fix things?
(This was system 6.0.3, finder 6.1 on an SE).

Harry Bochner
bochner@endor.harvard.edu