
@jestarray you can use CS for quite a while now and it is in production mode for a couple of releases I think. I certainly only use CS at this point. So go for it, and report back any problem you might find.

@mbk.alc has joined the channel

@idivyanshu.ranjan has joined the channel

We discovered CS bugs that seem worse than usual. Here’s a candidate for the worst one: https://github.com/racket/racket/commit/543dab59640fa5e911443baaadaae471406dbf40. So, by the rule we adopted for switching to CS, we’ll wait at least another release.
The development repo and snapshot builds have fully switched over to CS as the default, though, so we’re increasingly confident that the switch will work soon.

@slarlenesu has joined the channel


Hi all - does anyone have any tips for debugging a memory leak in a Racket program? So far I’ve been trying to instrument my code manually with calls to (current-memory-use)
to figure out which parts of my code are responsible for increases in memory usage, but it’d be really helpful if there was some sort of tool for automatically profiling where heap allocations are coming from. I tried to look a bit and couldn’t find any sort of Racket memory profilers, but was curious if anyone knows of something I may have missed - thanks in advance!

Does the profiler show memory usage or just cpu?

The best tool for this is the dump-memory-stats
function.

dump-memory-stats
can help, and it works better in Racket CS. With no arguments, it shows what kinds of objects are allocated. With more arguments, you can get object backtraces to show how a particular kind of object is retained.

(As usual, Sam and I write the same thing at once)

Here’s the help
output for it: > (dump-memory-stats 'help 'only)
Begin Dump
Current memory use: 94040096
Begin Help
(dump-memory-stats <spec> <modifier> ...)
where <spec> shows paths to objects:
<spec> = <symbol>
\| <predicate-procedure>
\| (make-weak-box <val>)
\| (list 'struct <symbol>)
and <modifier> controls that output:
<modifier> = 'new ; only trace new since last dump
\| 'max-path <exact-nonnegative-integer>
\| 'every <exact-positive-integer> ; show a subset
\| 'only ; skip table of object counts
End Help
End Dump

And here’s an example backtrace: > (define x (cons 1 2))
> (dump-memory-stats (make-weak-box x) 'only)
Begin Dump
Current memory use: 114069296
Begin Traces
*== (1 . 2)
<- #[#{variable rkt-linklet.sls-variable-0} (1 . 2) x x #f (#[#{instance rkt-linklet.sls-instance-0} top-level #[...] #[...]] . #f)]
<- (x . PREV)
<- #<tlc>
<- #(0 1 2 #<tlc> 4 5 6 7)
<- #<eq hashtable>
<- #[#{eq-mutable-hash rkt-rumble.sls-eq-mutable-hash-0} #f #() #f #<eq hashtable>]
<- #[#{instance rkt-linklet.sls-instance-0} top-level #[namespace49 #[module-path-index19 #f #f #[...] ()] #f #&#[...] 0 0 #&#stencil[600060001](...) #&#stencil[600060001](...) #[module-registry48 #[...] #&...] #[bulk-binding-registry45 #[...]] #&#stencil...
<- #[definitions50 #[#{instance rkt-linklet.sls-instance-0} top-level #[namespace49 #[...] #f #&... 0 0 #&... #&... #[...] #[...] #&... #f #f #[...] #[...] #[...]] #[#{eq-mutable-hash rkt-rumble.sls-eq-mutable-hash-0} #f #() #f #[...]]] #[#{eq-mutable-has...
<- #stencil[600060001](9 0 1 #[definitions50 #[#{instance rkt-linklet.sls-instance-0} top-level #[...] #[...]] #[#{eq-mutable-hash rkt-rumble.sls-eq-mutable-hash-0} #f #f #t #[...]]] #[definitions50 #[#{instance rkt-linklet.sls-instance-0} top-level #[......
<- ()
End Traces
End Dump

btw, @mflatt, (dump-memory-stats cpointer? 'only)
crashed the first time I ran it

ah, thanks! I had played with dump-memory-stats
a bit but overlooked the fact that you can use it to get a backtrace for an object as well

@kenbiondi217 has joined the channel

@benjamin.gramlich has joined the channel

@rebelsky has joined the channel

@samth It looks like backreference recording needed more updates for incremental generation promotion as merged from the main Chez Scheme implementation a few weeks ago. I’ll fix that.

Passing along from the author: Take 35% off your pre-order of Racket Programming the Fun Way through October 16th with code RACKETFUN at https://nostarch.com/racket-programming-fun-way. You’ll get an Early Access PDF of the entire book now. Print books will be sent as soon as we receive inventory - estimated for December 2020.

@mflatt Tiny typo, “unreognized”, at least in 7.8 CS > (dump-memory-stats 'help 'derp)
; dump-memory-stats: unreognized argument;

@mflatt Using the low-level error port makes this tricky to use when say the REPL is over a TCP connection since it ignores current-error-port
. Even if it’s possible to redirect the low-level error port somehow (is it even?) with multi REPLs the output would be mingled.

Not a huge issue I guess and I’m sure there’s a good reason to use the low-level error port (e.g. it’s the only thing knowable at the low level of the memory stat dumper).

You’re right that it’s because the output is written in a layer that doesn’t have Racket I/O, yet. Nothing would prevent the I/O layer from installing a function for dump-memory-stats
to use, though.

does anyone use pollen? pollen: ready to rock
Servlet (@ /) exception:
bytes->path: path string is empty
pollen: / directory default page
im getting this and i dont know where its coming from

i use (bytes->string) but i dont see bytes->path
in my codebase

ohhhhhhh

had to visit /index.ptree
.. without it, it will give that error

i cant find the setting for drracket to wrap my text to the next line once there are too many characters …

i see maximum character width guide
in Editing -> General Editing , but it doesnt move things to a new line

or was this never a feature….

Edit > Wrap text

@zackcarnet1 has joined the channel