3 ms·
> At this point I was tired so I fell asleep. This isn't done, of course -- we still need to chase the Rust program to figure out why that allocation never gets
by masklinn 10y ago
> At this point I was tired so I fell asleep. This isn't done, of course -- we still need to chase the Rust program to figure out why that allocation never gets freed. But it's a start!
The type of .boxed() would probably help. I would expect a .boxed to return a Box<_> (e.g. Vec::into_boxed_slice(v) returns a Box<[_]>) which would get RAII-deallocated. So either .boxed() returns a raw pointer for some reason, or it properly returns a Box but leaks internally.
- wyldfire 10y agoThere's a good chance that if the memory isn't getting deallocated that it's not technically a leak but rather unbounded growth. "Oh, oops, the refcount will never go to zero for this item I allocated."
- masklinn 10y agoAlso possible, but Rust's Rc/Arc are RAII'd, so that also shouldn't happen, you don't normally need to manually decref.
- wyldfire 10y agoYeah, I could've been more clear I meant "Oh, oops, I stored a reference of every single transaction ever, so we'll never reap that memory (because it will never get its refcount decremented automatically)." It's not a leak but this kind of thing is often detected as a positive slope in a process' RSS graph and it's common to refer to it as a "memory leak" because from this symptom it's indistinguishable from an actual leak.
- viscanti 10y agoThat's still a memory leak. It's just caused by a logic error that a compiler couldn't ever catch.
- wyldfire 10y agoWell, you might think it's a distinction without a difference but in fact it's not a leak. A leak only occurs when the handle one might use to deallocate memory/resources is itself deallocated. Whether "I added one FramistanObject to the FramistanObjectLog for every single HTTPConnection" is a logic error or not depends on what the intended design was.
- okasaki 10y agoValgrind calls that an indirect leak (stuff that wasn't freed at exit but is referenced by stuff that also wasn't freed)