fix(linux/kwin): explicitly cleanup screencast_t allocated memory resources to ensure nothing is leaking#5360
Conversation
…ources to ensure nothing is leaking
|
In theory this PR shouldn't make a difference as C++ should manage memory for those types (std::shared_ptr, std::map, std::vector) by itself correctly for how they are used in kwingrab. @psyke83 maybe you can check if it makes a difference on your end as my tests are a bit inconclusive right now... |
…er used outside of it
d839b36 to
285f5e1
Compare
|
|
Doing more testing and also cleaning up pipewire's destructor a bit but so far no luck with the memory leak. It's almost a stable ~16MB increase per full capture re-init for both kwingrab and portalgrab so the culprit is likely somewhere in Almost forgot: If I can't find the source of the leak myself I'll change this PR to do some code maintenance (like rolling 'cleanup_stream()` into the destructor as it's not used anywhere else anymore und updating a few unnecessary things based on CLion/Sonar suggestions). |



Description
In #5346 a memory leak in pipewire-based capture methods (portalgrab, kwingrab) was identified.
This PR is a (first) step to fix potential causes in
kwingrabby explicitly calling:reset()on any created shared_ptr instances in screencast_tclear()on used lists/maps in screencast_tduring destruction to ensure associated resources are always properly released.
Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage