Opened 21 years ago
Closed 21 years ago
#444 closed patch (fixed)
Memory leak - pespacket handling
| Reported by: | Stuart Auchterlonie | Owned by: | danielk |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.19 |
| Component: | mythtv | Version: | head |
| Severity: | low | Keywords: | memory leak |
| Cc: | Ticket locked: | no |
Description
Fixes a memory leak in the pespacket handling.
When the packet was cloned, but the allocated size according to the copied header was 0, it was allocating 188 bytes and thinking it didn't need to free it.
This adds a proper _isClone variable, which is used to check if the packet is a clone or not and hence if memory need freeing.
Attachments (1)
Change History (2)
by , 21 years ago
| Attachment: | pespacket-leak.diff added |
|---|
comment:1 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
(In [7432]) Fixes #444 and some other memory leaks.
This fixes the all the PES leaks I see on channel changes with the DVB recorder.
This doesn't use the patch in #444, but fixes that problem and other problems with PES packet memory allocation and use.
In TVRec and SIScan it adds missing ReturnCachedTable calls. It adds a DeleteCachedTable() to ATSCStreamData(), and adds an explicit destructor to ATSCStreamData() that calls Reset(). These changes prevent the leak of 8KB on each channel change.
This also fixes the leak reported in #444, but does this by handling the special case of a copy from a zero copy PES packet to a regular PES packet a little more correctly. This was leaking at least 512 bytes on each channel change.
This also adds a private memory allocation rutine for PES packets, which takes advantage high number of 188 byte and 4 KB allocations, falling back to malloc when it a packet is not one of these two sizes.
Finally, this fixes the handling of PES packets larger than 4 KB, before we would punt with a warning when this happened. With this commit we reallocate if the PES packet grows larger than the allocated size.

patch to fix pespacket memory handling