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

Memory leaks to 32gb within 10 seconds #646

Open
CornFarmerNZ opened this issue Oct 17, 2023 · 5 comments
Open

Memory leaks to 32gb within 10 seconds #646

CornFarmerNZ opened this issue Oct 17, 2023 · 5 comments

Comments

@CornFarmerNZ
Copy link

What version of Racket are you using?
version 8.9 [cs].

What program did you run?
Dragged two .rkt files into DrRacket, one by one, then switch between the tabs.

What should have happened?
Should be able to tab in-between the two .rkt files without memory usage instantly start rising by about 2gb/second.

If you got an error message, please include it here.
Screenshot 2023-10-17 at 12 57 05 PM

Please include any other relevant details
PC: M1 Mac
OS: Sonoma 14.0

@rfindler
Copy link
Member

Dragging two simple files (eg files that have only #lang racket/base at the top) doesn't seem to cause any issues, so it probably has something to do with what's in those two files.

Do you have the memory limit turned on (in the "Racket" menu, the "Limit Memory..." menu item)? If not, it may be that expanded the contents of the files uses an unbounded amount of memory (or maybe just a lot of memory).

@CornFarmerNZ
Copy link
Author

CornFarmerNZ commented Oct 17, 2023

Dragging two simple files (eg files that have only #lang racket/base at the top) doesn't seem to cause any issues, so it probably has something to do with what's in those two files.

Do you have the memory limit turned on (in the "Racket" menu, the "Limit Memory..." menu item)? If not, it may be that expanded the contents of the files uses an unbounded amount of memory (or maybe just a lot of memory).

I have a (Default?) limit of 128mb. Additionally, having the files open by their own (or having them both as tabs but never switching to the other) does not increase the memory usage abnormally - only when tabbing between the two.
Also, everything seems to work as expected when using my Windows pc.

File 1:

#lang eopl

(define the-lexical-spec
  '((whitespace (whitespace) skip)
    (comment ("%" (arbno (not #\newline))) skip)
    (identifier
     (letter (arbno (or letter digit "_" "-" "?"))) symbol)
    (keyword ("=") string)
    (number (digit (arbno digit)) number)))

(define the-grammar
  '(
    (program (expression) a-program)
    (expression (number) lit-exp)
    (expression (identifier) var-exp)
    (expression (primitive "(" (separated-list expression ",") ")") primapp-exp)
    (primitive ("+") add-prim)
    (primitive ("-") subtract-prim)
    (primitive ("add1") incr-prim)
    (primitive ("sub1") decr-prim)
    ))


; (define-datatype program program?
;   (a-program
;    (exp expression?)))
; 
; (define-datatype expression expression?
;   (lit-exp (datum number?))
;   (var-exp (id symbol?))
;   (primapp-exp (prim primitive?)
;                (rands (list-of expression?))))
; 
; (define-datatype primitive primitive?
;   (add-prim)
;   (subtract-prim)
;   (mult-prim)
;   (incr-prim)
;   (decr-prim))



;;;;;;;;;;;;;;;; sllgen boilerplate ;;;;;;;;;;;;;;;;
  
(sllgen:make-define-datatypes the-lexical-spec the-grammar)
  
(define show-the-datatypes
    (lambda () (sllgen:list-define-datatypes the-lexical-spec the-grammar)))
  
(define scan&parse
    (sllgen:make-string-parser the-lexical-spec the-grammar))

(define just-scan
    (sllgen:make-string-scanner the-lexical-spec the-grammar))

(define stmt1 "5")
(define stmt2 "x")
(define stmt3 "+(3,x)")
(define stmt4 "add1(+(4,x))")

File 2:

#lang eopl

(define the-lexical-spec
  '((whitespace (whitespace) skip)
    (comment ("//" (arbno (not #\newline))) skip) 
    (identifier ("=") string)
    (number (digit (arbno digit)) number)
  ))

(define the-grammar
  '(
    (program (statement) a-program)
    (statement (number) lit-exp)
    (statement (identifier) var-exp)
    (statement ("const" name) stmt-name)
    ;;(statement ("const" name "(" (separated-list name ",") ")" block) stmt-name)
    ))


; (define-datatype program program?
;   (a-program
;    (statement statement?)))
; 
; (define-datatype statement statement?
;   (lit-exp (datum number?))
;   (var-exp (id symbol?)))
; 
; (define-datatype name name?
;   (stmt-name (id string?))
;   )
; 



;;;;;;;;;;;;;;;; sllgen boilerplate ;;;;;;;;;;;;;;;;
  
(sllgen:make-define-datatypes the-lexical-spec the-grammar)
  
(define show-the-datatypes
    (lambda () (sllgen:list-define-datatypes the-lexical-spec the-grammar)))
  
(define scan&parse
    (sllgen:make-string-parser the-lexical-spec the-grammar))

(define just-scan
    (sllgen:make-string-scanner the-lexical-spec the-grammar))

(define stmt1 "5")
(define stmt2 "=")
;;(define stmt3 "+(3,x)")
;;(define stmt4 "add1(+(4,x))")

@sorawee
Copy link
Contributor

sorawee commented Oct 17, 2023

I can't reproduce the problem as well.

Observation: in your screenshot, you have a comment box, which is not preserved when copying over as text. Still, even after adding a comment box to the programs manually, I can't reproduce the issue.

@sorawee sorawee transferred this issue from racket/racket Oct 17, 2023
@rfindler
Copy link
Member

It is possible to attach actual files here; that may matter. I'm not on sonoma yet, so it might be an interaction between that and something in one of the GUI libraries.

If it isn't either of those, then starting from the command-line and hitting control-c in the Terminal window while it is very busy may give us some information. Specifically, if you open a Terminal window and do this:

% /Applications/Racket\ v8.9/bin/drracket 

and then open the files in DrRacket as usual, and then make it start going crazy and then hit control-c back in the terminal window, if we're lucky you'll get a stacktrace that'll point to the misbehaving code and maybe we'll then be able to figure out what's going on.

@CornFarmerNZ
Copy link
Author

It is possible to attach actual files here; that may matter. I'm not on sonoma yet, so it might be an interaction between that and something in one of the GUI libraries.

If it isn't either of those, then starting from the command-line and hitting control-c in the Terminal window while it is very busy may give us some information. Specifically, if you open a Terminal window and do this:

% /Applications/Racket\ v8.9/bin/drracket 

and then open the files in DrRacket as usual, and then make it start going crazy and then hit control-c back in the terminal window, if we're lucky you'll get a stacktrace that'll point to the misbehaving code and maybe we'll then be able to figure out what's going on.

I've just realised that it has been ~8-9 weeks of using DrRacket with no issues until now, right after I updated my MacOS version. Also, I tried with two different files and the same interaction occurs.
Screenshot 2023-10-18 at 5 51 26 PM

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