[comp.emacs] GNU Emacs memory usage on Sun 3/4.

drk@athena.mit.edu (David R Kohr) (02/04/90)

We have recently gotten Gnu Emacs (v. 18.55, I think) running on our
Sun 3's and Sun 4's.  I had heard that Gnu Emacs was a memory hog, so
I checked out the size of the executables with "size", and found out
that there was approximately 1 Mb. of code (text segment--this figure
is somewhat larger on the Sun 4) and only around 20 Kb. of data (data
segment).

Yet when running Gnu Emacs, and using the "vmstat" command to try to
estimate the real average per-copy memory usage of several separate
running copies (i.e., Gnu Emacs processes, invoked by separate login
processes), I found that only about 200 Kb. of actual memory was being used.  
"ps -u" reported similar figures.  So where was all of that 1 Mb. of code?  
Is each running copy of Emacs sharing the text segment with all the other 
running copes (which is perfectly feasible, for non-self-modifying
code), or is something else happening?

David R. Kohr   M.I.T. Lincoln Laboratory    Group 45 ("Radars 'R' Us")
	email:	KOHR@LL.LL.MIT.EDU   or   DRK@ATHENA.MIT.EDU
	phone:	(617)981-0775 (work),   (617)527-3908 (home)

mikef@sarah.lerc.nasa.gov (Mike J. Fuller) (02/04/90)

In article <1990Feb3.161555.13925@athena.mit.edu> drk@athena.mit.edu (David R Kohr) writes:
>Is each running copy of Emacs sharing the text segment with all the other 
>running copes (which is perfectly feasible, for non-self-modifying
>code), or is something else happening?

Yes, SunOS 4.* has shared text.  The text is also demand-paged from
the executable (unless you make it a pure executable by using the -n
option on ld when you link it).  And about self-modifying code -- the
text segment is read-only (unless you use the -N option on ld to make
it read-write).  I don't know about SunOS < 4.*, BSD or SysV.

/-----------------------------------------------------------------------------\
| Mike J. Fuller |Internet: mikef@sarah.lerc.nasa.gov     |You'd be paranoid, |
|----------------|          mikef@zippysun.math.uakron.edu|too, if everyone   |
|/\/\/\/\/\/\/\/\|Bitnet:   r3mjf1@akronvm                |was out to get you!|
\-----------------------------------------------------------------------------/