ricochet-im / ricochet

Anonymous peer-to-peer instant messaging
https://ricochet.im/
Other
3.7k stars 400 forks source link

Free all objects on exit to more easily detect memory issues #218

Open armadev opened 9 years ago

armadev commented 9 years ago

When I exit ricochet after even just a short run, valgrind tells me "still reachable: 1,345,391 bytes in 13,728 blocks". It sure would be convenient, for finding memory leaks and the like, if ricochet proactively gets rid of everything it can before exiting. Then it is easier to look at what is left.

special commented 9 years ago

Should be a simple matter of finding singletons and making sure they get freed. If someone is looking for a way to familiarize themselves with the code, this is a good one to pick :)

kolodziej commented 9 years ago

I've tried to use std::shared_ptr and std::unique_ptr in Qt apps, but it doesn't always work. (E.g. I had problem with QSystemTrayIcon to show it when I used std::unique_ptr as handler of pointer to dynamically allocated object of this class) I'll try to use QSharedPointer instead of normal pointers where it could help.