Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-29 Thread jackh...@gmail.com
I'm also guessing the jump from 600MB to 3GB is related to encodings. The file is probably UTF8/ASCII, and racket strings are a different encoding. I think they're one of the 32-bit encodings? So for ASCII text that alone would be a factor of four increase in memory usage. On Thursday,

Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-24 Thread Sam Tobin-Hochstadt
port->lines produces a list with all the lines in it. That list is what uses all the memory. Using in-lines avoids producing the whole list at once. Sam On Thu, Sep 24, 2020, 8:53 AM Hong Yang wrote: > Thanks Laurent, I tried (in-lines...), and yes, it's memory-efficient, but > I still curious

Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-24 Thread Hong Yang
Thanks Laurent, I tried (in-lines...), and yes, it's memory-efficient, but I still curious and concern why (port->lines ...) takes so many memory. Best regards Hong On Thursday, September 24, 2020 at 6:55:10 PM UTC+8 laurent...@gmail.com wrote: > Quick comment: of you don't need to load the

Re: [racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-24 Thread Laurent
Quick comment: of you don't need to load the whole file but want to parse it line by line, use `in-lines` which is memory-efficient. On Thu, Sep 24, 2020, 11:46 Hong Yang wrote: > Update with memory dump log attached. > > 1. With out (set! input empty), call (collect-garbage) doesn't help > 2.

[racket-users] Re: Memory usage of (port->lines ...) is extreamly high

2020-09-24 Thread Hong Yang
Update with memory dump log attached. 1. With out (set! input empty), call (collect-garbage) doesn't help 2. Call (set! input empty) and (collect-garbage), memory reduce dramaticly. ; 214M(VIRT)/101M(RSS) without open any file (let loop() (sleep 5) ; Waiting here so that I can check