This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#9885 - Add malloc library to codeclib
Attached to Project:
Rockbox
Opened by MichaelGiacomelli (saratoga) - Monday, 09 February 2009, 07:13 GMT+2
Last edited by MichaelGiacomelli (saratoga) - Tuesday, 19 April 2011, 02:16 GMT+2
Opened by MichaelGiacomelli (saratoga) - Monday, 09 February 2009, 07:13 GMT+2
Last edited by MichaelGiacomelli (saratoga) - Tuesday, 19 April 2011, 02:16 GMT+2
|
DetailsThis patch adds a malloc implementation to the codec library (malloc, calloc, realloc, free) based on Daniel's dbestfit. Tremor is adapted to use it.
This patch decreases the worst case vorbis memory usage by at least 200KB by properly freeing temporary buffers. No other changes are made, and the old broken malloc implementation is left alone (speex still uses it for the moment). While we have argued that malloc is not a good thing to have, removing it from tremor is probably not realistic, and the previous solution (tomal's attempts to use temporary mallocs) is unsatisfactory. Furthermore, once libfaad is fixed, this change will enable us to drastically shrink the codec buffer. |
This task depends upon
Closed by MichaelGiacomelli (saratoga)
Tuesday, 19 April 2011, 02:16 GMT+2
Reason for closing: Out of Date
Additional comments about closing: Unneeded now that we have a malloc in the codec library.
Tuesday, 19 April 2011, 02:16 GMT+2
Reason for closing: Out of Date
Additional comments about closing: Unneeded now that we have a malloc in the codec library.
We can then also offer access to this malloc system to plugins as well, to potentially make it easier for people to port stuff over to Rockbox.
Just a thought though, nothing major.
Is there some way to reinit the dmalloc library after a track change like the current rockbox malloc does? The current version does not do that, so if there is a memory leak, it will persist between tracks. I've tried setting to NULL the blockHead variable, but that doesn't seem to do it since attempting to pass the codecbuffer via add_pool() still crashes. I'll keep digging through the code, but I don't really understand a lot of it.
Edit: To be clear, I mean if I null blockHead and then try to readd the same pool of memory I still get a crash.
How does it compare to this malloc?