what's eating my ram?

Discussion in 'Mac Help/Tips' started by mnkeybsness, Feb 3, 2003.

  1. mnkeybsness macrumors 68030

    mnkeybsness

    Joined:
    Jun 25, 2001
    Location:
    Moneyapolis, Minnesota
    #1
    actually i know what is eating it...the real question is...why?

    here's the situation:

    i'm taking a computer science course in which we are starting out learning LISP and SCHEME. all of this i can do through the terminal on my powermac, i just needed to download the STK interpreter. the other night when i was working on a definition for deriving cubed roots ... here's the working code that i will be handing in for my assignment:

    (define (cube-root x)
    (define (cube x)
    (* x x x))
    (define (improve y x)
    (/ (+ (/ x (* y y)) (* 2 y)) 3))
    (define (good-enough? guess x)
    (< (abs (- (cube guess) x)) 0.001))
    (define (cbrt-iter guess x)
    (if (good-enough? guess x)
    guess
    (cbrt-iter (improve guess x)
    x)))
    (cbrt-iter 1.0 x))

    the first time i wrote this, i messed up and had an extra formula inside, which made the procedure run forever, never finding a (good-enough?) answer. when this happens, STK will lock out not letting me do anything in that xterm. so i terminated the terminal window and opened a new one...i did this a few times while trying to find out what the problem was (probably about 4-5 times). i noticed all 1024mb of RAM on my machine was being used (via Aquamon). i opened the process viewer to notice that about half of my processor and 3/4 of my ram was beig taken up by the STK modules still, even after quitting out of the Terminal program?

    so now i beg the question:

    why won't the system stop the operation?

    i had to restart to get my RAM back
     
  2. evildead macrumors 65816

    evildead

    Joined:
    Jun 18, 2001
    Location:
    WestCost, USA
    #2
    CS

    I am a CS student my self and remember having to do some work with LISP.

    When you killed xTerm your process may not have really died. You can to a ps -e and find the process number of runaway processes. then kill it.

    # ps -e | grep <processName>
    0r
    # ps -e
    and just look for it

    then

    # kill <process number>
    or
    # kill -9 <process number>
    to force it

    It seems a bit extream to me for you program to eat up all that RAM, endless or not. How long was it running before you tried to stop it?
     
  3. mnkeybsness thread starter macrumors 68030

    mnkeybsness

    Joined:
    Jun 25, 2001
    Location:
    Moneyapolis, Minnesota
    #3
    awesome thanks!

    one of them i let run for about 5 minutes...others just about a half a minute

    but why doesn't it completely kill the operation?
     

Share This Page