summaryrefslogtreecommitdiff
path: root/firmware/core_alloc.c (follow)
Commit message (Collapse)AuthorAge
* Make a few local variables staticThomas Jarosch2015-01-11
| | | | Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
* Improve core_alloc() / buflib_alloc() documentationThomas Jarosch2015-01-02
| | | | | | | | | | | | | | | | | | | | Document the fact that buffers are movable by default. Care must be taken to not pass them to functions that yield(). Also clarify other things: - Passing NULL as "ops" to buflib_alloc_ex() causes buffers to be movable by default (but not shrinkable). - If you want shrinkable buffers during compaction, you have to provide a shrink callback. - To disable buffer movement, you have to pass NULL for the move_callback inside the callback structure. - The concept of default callbacks was removed long ago, remove the only reference of it. Change-Id: I3bf0ea6b08b507d80a19f3c2c835aca32b3f7800
* buflib: Properly support allocations without any name, to avoid wasting spaceThomas Martitz2014-02-02
| | | | | | in micro-allocation scenarios. Change-Id: I97a065bcfba8e0fda9b1670445e839e267c769c8
* hosted: Substract more than 256K from total memory pool.Thomas Martitz2014-02-02
| | | | | | | | These 256K are intended to account for the binary size which reduces the total available RAM on native targets. 256K is really outdated though, 768K should be more accurate (for the majority of targets). Change-Id: Iab3ee51d42ae15b1b7efb8588881579cf1948ae7
* buflib: Add crc field protecting buflib cookie integrityMarcin Bukat2014-01-16
| | | | | | | | | | | | | | | This should catch the case of buffer misuse which results in corrupted cookie of next allocation. The check is performed on move_block() so it may be a bit late. There is buflib_check_valid() provided which checks the integrity of all cookies for given context. On DEBUG build with --sdl-thread this check is carried out for core_ctx on every context switch to catch problems earlier. Change-Id: I999d4576084592394e3dbd3bdf0f32935ff5f601 Reviewed-on: http://gerrit.rockbox.org/711 Reviewed-by: Thomas Martitz <kugel@rockbox.org>
* buflib: Change buflib_available() and add buflib_allocatable().Thomas Martitz2013-07-07
| | | | | | | | | | | | | | | buflib_allocatable() is what buflib_available() was before (it was in fact simply renamed). It returns the largest contiguous block of memory. This can be allocated and will definitely succeed, although larger allocations may also succeed if the buffer can be compacted and shrinked. buflib_available() now counts all free bytes, contiguous or not. This better matches the description and how the caller use it. Change-Id: I511e4eb5f4cf1821d957b3f4ef8a685ce40fe289 Reviewed-on: http://gerrit.rockbox.org/481 Reviewed-by: Thomas Martitz <kugel@rockbox.org> Tested-by: Thomas Martitz <kugel@rockbox.org>
* Integrate the warble tool in the regular build system.Frank Gevaerts2012-03-03
| | | | | | Only sdl app builds work properly for now. Change-Id: I7807d42f69b8577b401e48cdc63de71e54f49217
* FS#12412 : Delete old buffer allocation code which has been replaced by ↵Boris Gjenero2011-11-29
| | | | | | core_alloc, and move buffer setup code to core_alloc.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31088 a1c6a512-1295-4272-9138-f99709370657
* core_alloc: Provide a tiny test allocation, which can be freed for debug ↵Thomas Martitz2011-10-05
| | | | | | | | | | purposes. This allocation can be freed in the buflib debug menu (select it to free). Doing a another allocation, e.g. by selecting another item in this debug menu will cause compaction (all allocs move). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30719 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Enable compaction in buflib.Thomas Martitz2011-08-30
| | | | | | | | | | | | | | | | | | | This enables the ability to allocate (and free) memory dynamically without fragmentation, through compaction. This means allocations can move and fragmentation be reduced. Most changes are preparing Rockbox for this, which many times means adding a move callback which can temporarily disable movement when the corresponding code is in a critical section. For now, the audio buffer allocation has a central role, because it's the one having allocated most. This buffer is able to shrink itself, for which it needs to stop playback for a very short moment. For this, audio_buffer_available() returns the size of the audio buffer which can possibly be used by other allocations because the audio buffer can shrink. lastfm scrobbling and timestretch can now be toggled at runtime without requiring a reboot. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
* GSoC/Buflib: Add buflib memory alocator to the core.Thomas Martitz2011-08-30
The buflib memory allocator is handle based and can free and compact, move or resize memory on demand. This allows to effeciently allocate memory dynamically without an MMU, by avoiding fragmentation through memory compaction. This patch adds the buflib library to the core, along with convinience wrappers to omit the context parameter. Compaction is not yet enabled, but will be in a later patch. Therefore, this acts as a replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug menu. See buflib.h for some API documentation. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657