Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrRacket GUI for plai/gc2/mutator crashes #94

Open
jameswhang opened this issue Feb 21, 2017 · 5 comments
Open

DrRacket GUI for plai/gc2/mutator crashes #94

jameswhang opened this issue Feb 21, 2017 · 5 comments

Comments

@jameswhang
Copy link

jameswhang commented Feb 21, 2017

DrRacket GUI that displays the heap for plai/gc2/mutator language seems to run out of memory when the heap has sufficiently large number of floats, but the mutator program itself doesn't stop executing and causes DrRacket to display a ton of out of memory window.

screen shot 2017-02-21 at 11 15 29 am

An example mutator that causes this error is shown below.

#lang plai/gc2/mutator

(allocator-setup "mark-and-sweep.rkt" 500) ; This is a standard mark-and-sweep gc collector as described in https://www.eecs.northwestern.edu/~robby/courses/321-2015-winter/lecture12.pdf

(define guess 0)

(define (sqrt x) ; dumb way
  (set! guess x)
  (sqrt-rec (/ x 2) x))

(define (sqrt-rec guess x)
  (if (close? guess x)
      guess
      (begin
        (set! guess (improve guess x))
        (sqrt-rec guess x))))

(define (average x y)
  (/ (+ x y) 2))

(define (square x)
  (* x x))

(define (abs x)
  (if (< x 0)
      (- 0 x)
      x))

(define (improve guess x)
  (average guess (/ x guess)))

(define (close? guess x)
  (< (abs (- (square guess) x)) 0.001))

(define (run num)
  (if (= 0 num)
      0
      (begin (sqrt 1000000)
             (run (- num 1)))))

(define a (run 100))

Closing the heap window doesn't cause DrRacket to crash, so the problem seems to be with the rendering of heap window.

@jeapostrophe
Copy link
Contributor

It seems like this is the expected behavior... if you allocate a huge amount of memory, while imposing a memory limit, then you should expect an error that you violated the memory limit?

@rfindler
Copy link
Member

rfindler commented Feb 21, 2017 via email

@jameswhang
Copy link
Author

The expected behavior that I expected was for the out of memory error message to show up once and stop the mutator program from running..

@jeapostrophe
Copy link
Contributor

Sorry I missed that part of the message.

@rfindler Can you tell what's happening? Am I catching an error and letting it continue so DrRacket makes another one?

@rfindler
Copy link
Member

rfindler commented Feb 21, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants