pocmatos
2020-10-6 12:32:21

@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
2020-10-6 12:41:23

@mbk.alc has joined the channel


idivyanshu.ranjan
2020-10-6 12:41:28

@idivyanshu.ranjan has joined the channel


mflatt
2020-10-6 12:51:25

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
2020-10-6 13:11:44

@slarlenesu has joined the channel


spdegabrielle
2020-10-6 14:52:38

moroze
2020-10-6 16:49:30

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!


soegaard2
2020-10-6 17:03:45

Does the profiler show memory usage or just cpu?


samth
2020-10-6 17:20:19

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


mflatt
2020-10-6 17:20:22

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.


mflatt
2020-10-6 17:20:31

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


samth
2020-10-6 17:20:52

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


samth
2020-10-6 17:21:15

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


samth
2020-10-6 17:23:15

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


moroze
2020-10-6 18:07:10

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
2020-10-6 18:25:11

@kenbiondi217 has joined the channel


benjamin.gramlich
2020-10-6 19:10:45

@benjamin.gramlich has joined the channel


rebelsky
2020-10-6 19:33:28

@rebelsky has joined the channel


mflatt
2020-10-6 21:04:25

@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.


mflatt
2020-10-6 21:42:49

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.


greg
2020-10-7 00:04:33

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


greg
2020-10-7 00:07:05

@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.


greg
2020-10-7 00:07:58

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).


mflatt
2020-10-7 01:27:04

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.


jestarray
2020-10-7 01:52:02

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


jestarray
2020-10-7 01:52:27

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


jestarray
2020-10-7 01:55:19

ohhhhhhh


jestarray
2020-10-7 01:55:40

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


jestarray
2020-10-7 02:13:52

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


jestarray
2020-10-7 02:16:36

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


jestarray
2020-10-7 02:17:13

or was this never a feature….


sorawee
2020-10-7 02:49:34

Edit > Wrap text


zackcarnet1
2020-10-7 04:46:14

@zackcarnet1 has joined the channel