GithubHelp home page GithubHelp logo

Comments (16)

greghendershott avatar greghendershott commented on June 12, 2024

Can you help me understand an example use case for this? I've never really appreciated how/when/why this feature is desirable in DrRacket. In addition to helping me understand, I could probably also use you specific example for a test case.

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

This crashed my system. I used wrong argument lst2 instead of lst2-to-cdr.

#lang racket

;Cartesian product
(define product
  (λ (lst1 lst2)
    (if (null? lst2)
        (quote ())
        (product-aux lst1 lst2 lst2))))

(define product-aux
  (λ (lst1 lst2 lst2-to-cdr)
    (cond [(null? lst1) (quote ())]
          [(null? lst2-to-cdr) (product-aux (cdr lst1) lst2 lst2)]
          [else (cons (list (car lst1) (car lst2-to-cdr)) 
                      (product-aux lst1 lst2 (cdr lst2 #;-to-cdr )))]
          )))

(module+ test
  (require rackunit rackunit/text-ui)

  (define tests 
    (test-suite "TestSuite"
                (check-equal? (product '(a b c) '(x y))
                              '((a x) (a y) (b x) (b y) (c x) (c y)))
                ))

  (run-tests tests))

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

Thank you for the example!

This crashed my system

To make sure I understand what you mean by "system" -- do you mean that Emacs crashed, or your entire computer/OS?


I did a few experiments using custodian-limit-memory. In some cases I got an explicit "out of memory" error (good) but in other cases it just seemed to keep running silently (?).

I'll need to spend more than 5 minutes to understand how it works and what's expected; and perhaps ask some questions on the Racket mailing list.

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

Entire OS was not responding, HDD was active constantly. Only cold reset helped.
Windows 7x64, GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601) of 2013-03-18 on MARVIN

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

Ouch. It would be great if you could report that as a bug to the Racket team, here, too?

At the same time, I spent some time looking into adding support for racket-mode to support a memory limit like DrRacket. Although I don't have something I think is quite ready to push as a commit, I hope to soon.

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

Tried the code with a page file disabled. Now I can terminate the process by agreeing with dialog window:

Microsoft Visual C++ Runtime Library
-------------------------------------------------
Runtime error!
Program: C:\...\Racket.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
[OK]

cmd prints Racket virtual machine has run out of memory; aborting
racket-mode REPL: Process Racket REPL exited abnormally with code 3 (code 29 once)


  • This dialog displays normally with Windows Aero Mode disabled. With Aero there is only an icon on a task bar.
  • With the page file I'd waited about 3 minutes when the monitor went black, hdd was kept busy.
  • It takes about half a minute to reach the memory limit (8Gb, without page file). So, is it a bug or not, but for the comfort work the memory limit is vital.
  • Should I really report a bug to Racket (after my research) ?

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

Your code isn't explicitly disabling breaks, so, you should be able to break it. If that's not possible in some scenarios on Windows, it should be considered a bug in Racket.

The Racket devs are super friendly about bug reports, especially with the level of detail you have here. So, even if I'm mistaken and they don't consider it a bug (?), I think they'd welcome the report.


Having said all that, I still plan to add the memory limit to racket-mode. I worked on it yesterday. It worked in the sense that the program stopped allocating more memory (good), and I could C-c break it on OS X (good) -- but it didn't stop automatically and give an explanation like DrRacket does (bad). So I need to figure that out.

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

OK, I figured out the missing piece, how to handle custodian-limit-memorys automatic shutdown.

For now I only pushed this to a topic branch, limit-memory. @JohnGurin have you installed racket-mode from MELPA, or from source here? If the latter, could you please try the limit-memory branch for me on Windows?

I ask because I'm away from home for several weeks, and home is where I have a Windows laptop with which to test. I'm 90% sure this will work correctly for you on Windows, but I'd love to hear you confirm it if possible before I merge to master.

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

F5 / Ctrl+F5 doesn't work.
Racket REPL output: ; "c:/Users/John/Documents/racket/myfile.rkt" not found
Cloned master and limit-memory branches. Tried them both in turn (by switching folders). master works.

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

That might happen if Emacs has "stale", master-branch versions of some Elisp functions like racket-run, and they don't match the Racket code. I had to change the ,run and ,top commands to take an optional memory-limit parameter.

Could you please try:

  1. Quit Emacs completely.
  2. Switch to using the limit-memory branch.
  3. Start Emacs.

Please let me know if that works?

(If it doesn't, then either I need to wait a few weeks until I have access to my Windows laptop, or, get access to Windows some other way like buying and installing under Virtual Box.)

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

@JohnGurin Never mind -- I got access to Windows and I can repro the problem you're seeing. Working on a fix.

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

This commit works for me on Windows: ca68ab5

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

This commit fixed the issue.


Oops! Tried the path with non-Latin characters and spaces. Non-Latin characters are no trouble.
Spaces causes this:
Racket REPL output:

Welcome to Racket v6.1.1.
≺≻ ; UNKNOWN::0: read: expected a closing '"'
; Context:
;  c:\Users\John\AppData\Roaming\.emacs.d\site-lisp\racket-mode\cmds.rkt:30:2
≺≻ 

master handles spaces.

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

Good catch! I just pushed bac69e1 which works for me with filenames containing spaces, including on Windows.

Please let me know if you have any other problems or issues, using that commit? Otherwise I'd like to merge to master.

from racket-mode.

JohnGurin avatar JohnGurin commented on June 12, 2024

Seems to work without flaws

from racket-mode.

greghendershott avatar greghendershott commented on June 12, 2024

Great. Likewise on my end. I'll merge to master. MELPA should pick up that change soon thereafter.

Thank you for your help testing this.

from racket-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.