Preventing memory leaks entirely is not one of rust's guarantees, meaning memory leaks are memory safe in rust. However, it is safe to assume that in rust, you do not have any memory leak, unless you do a very specific thing Also, note that if you adopt a loose definition of the memory leak, there are infinite ways to create one, for example, by adding some data in a container without releasing the unused one. Memory leak/ excesive ram usage fix hello, i've found a fix that actually works for when rust uses up all the ram The previous solution was to disconnect from the server and reconnect Now i've found, monitoring my resources that just typing free in the console will bring the game, at least on my system, to about 5.2 ram usage.
Either way i'm not sure why rust is using that much memory, never did for me Anyway, if you increase the page file size, unused data in the memory will be moved there, and your pc won't crash (in theory) Lmk if this works reply reply [deleted] • new ram both sticks upgrade to 32 gb if ram reply reply craftbot • Learn how to manage memory leaks in rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs. Rust devs — don't let your app silently bleed memory Learn how to plug the leaks with simple, effective fixes for ownership, cycles, and async gone wrong.
However, even rust isn't immune to these issues under specific circumstances This blog post serves as a reminder to my past self, who had to identify and resolve a memory leak in a rust application, and a cautionary tale for my future self. Thus, allowing mem::forget from safe code does not fundamentally change rust's safety guarantees That said, leaking resources such as memory or i/o objects is usually undesirable The need comes up in some specialized use cases for ffi or unsafe code, but even then, manuallydrop is typically preferred. My rust program (well, game) is leaking memory, 4mb/s
How do i pinpoint the issue The only ffi library i'm using is imgui, so i'd place my first bets there although the drop implementations do work in other stages At the current rate, it only takes a few minutes to jump from 21mbs to 1.6gbs of memory usage It is believed that it is impossible to leak memory with rust, that is not true Although is way more difficult to leak memory in rust than in other languages, it can happen, sometimes by accident, and sometimes, by design In this article we will explore some cases where leaking memory is useful