Limiting Dr. Racket's memory
Asked Answered
U

3

6

I augmented the memory of Dr. Racket a week ago, now I want to reduce it to the same amount as before. So I limit it back to 128 MB. But that has no effect... It is always consuming much more then 128 MB...

It's really a problem because it causes my computer to overheat. Does someone know how I can limit Dr. Racket so that he don't exceed 128 MB?

Here's a screenshot of the problem :

enter image description here

Unseemly answered 21/3, 2015 at 11:42 Comment(0)
C
8

There is a difference between the memory used by a program and the memory used in total by DrRacket. When I start up DrRacket and before entering or running any program I see that DrRacket uses 250MB. The interaction window states I have limited memory to 128MB too so that means that that particular program cannot go beond those bounds, but there are featrues of DrRacket that uses alot more memory on you machine than mine.

I went into the settings and removed some features I don't use (like Algiol60). When restarting after that I used 50MB less memory which indeed confirms the memory is used by DrRacket and not programs.

For a particular complex program I guess background expansion might use a lot of memory. Perhaps you can turn that off as well to see if not the current used memory goes down.

About heat

As Óscar mentioned memory usage has little to do with heat as long as you don't hear the swap is being used (heavy disk usage). Heat has to do with CPU usage. When doing calculations the OS will make available resources available and perhaps increase the frequencey of the CPU which increases the heat.

If you are making a threaded application that has loops waiting for tasks make sure you are not making an active loop. Sleep might reduce activeness and perhaps Racket has better approaches (never done threded apps in Racket)

If you are calculating something the increase of CPU is natural. It's so that you get the answer earlier. Computer settings can be changed to favor battery time. Check both OS and BIOS. (That makes this not a Racket issue)

Certitude answered 21/3, 2015 at 19:32 Comment(1)
I checked in my preferences and I guess the high memory usage comes from the fact all the tools are launched when Dr Racket starts. I disabled "Algol60", "Macro Stepper" (never used it), "how to design programs" and so on, but I don't really know what they are doing. I searched the documentation but they don't explain what each tool is doing. I will disable as much as possible and really try only to enable necessary things like "Check syntax" and so.Unseemly
L
3

The memory shown in the Dr Racket status bar is N/A.

Experiment:

  1. Choose Racket | Limit Memory and specify 8 MB (the minimum).
  2. Choose File | New Tab.
  3. In the Interactions pane allocate 8 MB of memory. For example enter (define x (make-bytes (* 8 1024 1024))). (I recommend assigning the result to a variable, like this, because I doubt you want Dr Racket to print 8 MB of bytes.)

The result I get:

Welcome to DrRacket, version 6.1.1.6--2014-12-21(aabe9d7/a) [3m].
Language: racket [custom]; memory limit: 8 MB.
> (define x (make-bytes (* 8 1024 1024)))
out of memory 
> 

Assuming you get the same result, there is some other reason your computer is running hotter.

Latisha answered 21/3, 2015 at 20:36 Comment(0)
R
2

I don't think that the extra memory being consumed is the cause for your computer overheating. More likely, it's because some function is consuming the CPU. Try to optimize the code, instead.

In fact, by limiting the available memory you might end up causing more disk paging, hence slowing things down and potentially consuming more CPU … and causing more overheating.

Rhyme answered 21/3, 2015 at 15:25 Comment(2)
That's true but when I was working on a project a week ago with only 128 MB, all was going well, but then I accidentally augmented the memory limit to much more. Afterwards I noticed that when working on the same project in Dr Racket, my computer overheats (I didn't had that problem before augmenting the memory limit). So I reduced the memory limit back to 128 MB but that didn't helped. So if first with 128 MB and the same project it didn't overheat, it shouldn't overheat now ?Unseemly
It won't cause more disk usage. When you hit the limit the running program is halted.Certitude

© 2022 - 2024 — McMap. All rights reserved.