Re:Fixing a memory leak of xmlEntityPtr in librsvg
by oguz-ismail on Monday June 24, 2024 @01:48AM
(#40772917)
`finally' is a word though, harder to forget than a single punctuation mark.
Re:Fixing a memory leak of xmlEntityPtr in librsvg
by filmor on Monday June 24, 2024 @08:01AM
(#40774988)
The dev did not "forget a single punctuation mark". It was there and it was correct. What was /not/ correct is that he did not implement any form of implicit resource freeing in an RAII-language. Doing resource management using scopes is a choice. It's not inherently better or worse than explicit resource management with something like Go's `defer`. But if that choice is made, as in Rust or C++, you have to ensure that the implicit resource management is correctly implemented (Drop in Rust, destructors in C++). Same as in Go, where you have to ensure that you call `defer` with the correct cleanup function or in C# where you have to use `using` on your disposables, etc.
I do not know what metric you use to define "better"