On Wednesday, August 12, 2015 at 1:02:00 PM UTC-4, Juan Francisco Cantero 
Hurtado wrote:
> On 08/12/2015 05:24 AM, Brian Adkins wrote:
> > I just installed 6.2.1 on a Linux VPS via the "Unix Source + Built 
> > Packages", and the install went smoothly. I created a standalone executable 
> > of a simple IRC bot I'm putting together via:
> >
> > raco exe ircbot.rkt
> >
> > When I run it the vsz=209440 and rss=63396. ~ 64 MB seems a little high to 
> > me.
> >
> > Are there any arguments I can supply to either raco when creating the exe, 
> > or to the exe when running it, that might reduce the runtime memory 
> > consumption?
> >
> > In other words, is Racket possibly pre-allocating large chunks of RAM that 
> > I can limit?
> >
> > I'll post the source to the ircbot later, but it's really minimal at this 
> > point - opens a TCP connection to the freenode server and an output file 
> > channel for some logging, not much going on. I just ran a test with a file 
> > that has only (sleep 60), and it used about 50 MB RAM.
> 
> Change "#lang racket" to "#lang racket/base" and import manually each 
> lib used by your code. Also, run "raco make yourscript.rkt", it reduces 
> slightly the memory used by racket.
> 
> With both changes, I see a reduction of RSS from 47.5 MB to 14.5 MB in 
> your (sleep) example.

Thanks! I ended up with the following for the ircbot:

(require racket/tcp)
(require racket/string)
(require racket/match)
(require racket/format)

DrRacket was super helpful in identifying which packages I needed to require.

Using "raco exe ircbot.rkt" dropped the numbers down to:

vsz=165428 rss=49588

Using "raco make ircbot.rkt" followed by racket ircbot.rkt dropped the numbers 
to:

vsz=150256 rss=35484 - still a little portly, but much better :)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to