3 ms·
If you don't mind me asking - how do you witness these low level memory allocations? Specific program, plugin to vs code?
by CapmCrackaWaka 4y ago
If you don't mind me asking - how do you witness these low level memory allocations? Specific program, plugin to vs code?
- spacechild1 4y agoYou look at the generated assembly.
- adrian17 4y agoThe simplest way to make quick experiments for me is with https://godbolt.org/ https://godbolt.org/ . For my particular example: https://godbolt.org/z/8GvYzYj5h https://godbolt.org/z/8GvYzYj5h You can see we're trying to put a 1kB object on heap, but the compiler generates two `memcpy` calls - first to copy it on stack to build the wrapper struct, second to actually copy the entire struct onto allocated memory. In "real programs", you just need to look at the program's assembly. Or even more generally, I originally noticed this when observing the unusually high amount of time spent in some functions when profiling.
- hmfrh 4y agoOther than Godbolt Rust also has cargo-show-asm[1] that directly shows the actual assembly. [1]: https://crates.io/crates/cargo-show-asm https://crates.io/crates/cargo-show-asm