Ok, it looks like GOROOT is managed by go. See go env
.
GOPATH seems like it needs to be managed still.
I've switched over to using go env
for my information
(OS, ARCH, VERSION). Which seems cleaner and clearer.
Ok, memory usage is about 1.8MB peak heap usage. (Tokio & non-async), so chunks and write_to work the same.
https://poby.medium.com/memory-profiling-using-valgrind-b30514f35117
valgrind --log-file=memory1.log target/release/go-up update
No leaks. As if... ;)
valgrind --tool=massif --stacks=yes --log-file=valgrind3.log target/release/go-up update
massif-visualizer massif.out.2496324
Logging total memory usage:
cargo build --release; valgrind --log-file=memory1.log target/release/go-up update
==2470578== HEAP SUMMARY:
==2470578== in use at exit: 796,398 bytes in 5,858 blocks
==2470578== total heap usage: 217,384 allocs, 211,526 frees, 269,243,726 bytes allocated
==2470578==
I was concerned about the total bytes allocated, but that's not all at one time.
Example run:
thor@mount-olympus:~/Development/rust/reqwest/go-up$ cargo run -- update
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/go-up update`
Version: 1.24.2 [have 1.23.4]
Downloading newer version...
Clearing GOROOT /home/thor/go
Clearing GOPATH /home/thor/gopath
Extracting...
Extract cache/go1.24.2.linux-amd64.tar.gz to /home/thor/go
Updated 1.23.4 to 1.24.2