Apparent system memory leak on simple training task using WGPU backend
I had previously reported a memory leak in WGPU under Burn 0.13, see #2042
That particular leak does not appear to exist anymore; however, I'm seeing a slower leak that results in tens of gigabytes of system memory used after about 5 days' runtime on Burn 0.21.
Since I can't re-open that issue, I'm making a new one. You can see the updated code at the same repository I used previously, https://github.com/joshhansen/burnleak
Of course, even though the memory usage accumulates more slowly now, it can still become prohibitive on long training runs.
Describe the bug A simple model training example run for multiple days on the WGPU backend appears to leak system memory in large quantities.
To Reproduce
git clone https://github.com/joshhansen/burnleak.git
cd burnleak
cargo build --profile release-final
./target/release-final/burnleak
Wait a few days.
Check htop, see if burnleak now consumes 10GB+ of system memory.
To fire and forget use:
/usr/bin/time -v /usr/bin/timeout 7d ./target/release-final/burnleak
This will run burnleak for seven days and report on its resource usage; look for "Maximum resident set size"
Expected behavior While some memory allocation is obviously expected even for this simple training task, there should be a ceiling to the allocations, and it should be much lower than 17.9GB.
Screenshots
Desktop (please complete the following information):
- Debian 13
- Burn 0.21
- Rust 1.98
- Nvidia 615.71.09
Other
- Run it again on --release build to check whether the LTO and single unit compilation are somehow involved
- Run again on Flex backend
Source: tracel-ai/burn