When You Run Out of Memory?


LaTeX is a program that takes a lot of memory to run (it is designed to be portable to [for example] PC's which don't have the dynamic memory allocation features that UNIX does, so it is suboptimal in our environment). Many people who run out of memory with LaTeX have interrupted previous sessions with ^Z. This only stops a process, and does not kill it, so it still uses memory. To kill LaTeX, you should type X at the prompt you get after it finds an error.

If you are truly running out of memory (i.e. you do not have stopped LaTeX jobs), the only solution is to kill off something you don't want and try again. To kill a process, you can use one of several methods:

  1. Type jobs, followed by kill %# (# is the number you see in the job listing next to the job you want to kill). This can only be used to kill jobs started from the same xterm window you run the commands in. For example:
    % jobs
    [2]  + Stopped              telnet e40-342-8
    % kill %2
    [2]    Terminated           telnet e40-342-8 (wd: ~)
    %
    
  2. Type ps, and look for the process you want to kill. There will be a number in the left column, which is the process ID you should give as the argument to kill. There are distinctions between job numbers and process IDs; in particular, process ID's are global to the workstation, but jobs are per shell (xterm). For example, suppose you get this output:
    athena%  ps
      PID TT STAT  TIME COMMAND
      344 mo I     0:04 -csh (csh)
      422 mo IW    0:00 xinit .xsession
      424 mo IW    0:00 sh /u2/users/jfc/.xserverrc
      425 mo S N  85:16 /etc/Xibm -mpel -aed -bs :0
      426 mo IW    0:00 sh ./.xsession
      434 mo S     0:48 /usr/bin/X11/uwm
      435 mo I     0:01 /usr/bin/X11/uwm -display unix:0.1
      649 mo I     0:48 /u1/Xibm :0 -apa16 :1
      651 p0 I     0:01 -sh (csh)
      653 p0 I     0:09 uwm
      807 p0 I     0:01 olcr
      453 p1 I     0:02 -sh (csh)
      451 p2 I     0:01 -sh (csh)
      452 p3 S     0:13 -sh (csh)
      826 p3 R     0:00 ps
      457 p4 I     0:00 /usr/athena/lib/gnuemacs/etc/server
      465 p6 I     0:22 /mit/discuss/rt/edsc/edsc
    
    
    To kill your window manager on display unix:0.1, you would type:
    kill 435
    This form is useful, because not all programs are started interactively (and only interactively started programs can be found by jobs, while all programs can be found with ps).