Closed correctmost closed 9 months ago
You're not wrong!
On the other hand, once all the documents the user wants to save have been saved and we're going to quit, there's really no point in de-allocating outstanding allocations as they'll all be recovered on exit. We could add extra code to meticulously traverse all the dynamic structures and free everything before exiting, but there would be no benefit. The only effects would be that the executable would be larger and exiting the program would be slower.
At least, that's the assumption we've been working under until now. If there's a counter case to be made, I would certainly like to know about it. Otherwise, I'm disinclined to add code to address this particular issue.
Even so, I'll leave this issue open for now to allow space for other opinions.
Last but not least, thanks for your interest in the project. We really do appreciate the time and effort people put in, even if we sometimes choose not to act on a particular issue.
Thanks for taking a look. I think the primary benefit of cleaning up structures before exiting is that it can make it easier to detect new leaks that are introduced.
As you mentioned, though, it does require extra code, extra processing, and extra testing. If the general strategy is to let exit handle some of the deallocations, then it probably doesn't make sense to patch just this issue :).
That's a legitimate point. We do have other code that is conditionally included, for example only for the test suite, but that isn't part of a "regular" build. Perhaps it does make sense to conditionally include complete clean-up code so that, as you say, detecting new leaks would be easier. Must give this some thought.
In the meantime, I think we can consider this issue closed.
Steps to reproduce:
Leak report:
Version: c2c58b96cd289fb003fb51d88f7af7ede0f410cc