summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-10-05 18:32:19 +0000
committerThomas Martitz <kugel@rockbox.org>2011-10-05 18:32:19 +0000
commit4478b25ede0129b1572145737627db7297dcc89f (patch)
tree26e30d0021ee7d3433ec055c4576cb24f14d9080 /apps/debug_menu.c
parent6efb3f0760b54fb80423924a7aab17da043dbba9 (diff)
downloadrockbox-4478b25ede0129b1572145737627db7297dcc89f.zip
rockbox-4478b25ede0129b1572145737627db7297dcc89f.tar.gz
rockbox-4478b25ede0129b1572145737627db7297dcc89f.tar.bz2
rockbox-4478b25ede0129b1572145737627db7297dcc89f.tar.xz
core_alloc: Provide a tiny test allocation, which can be freed for debug 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
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 7c2e6c7..e96b8c5 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -429,14 +429,21 @@ static int bf_action_cb(int action, struct gui_synclist* list)
{
if (action == ACTION_STD_OK)
{
- splash(HZ/1, "Attempting a 64k allocation");
- int handle = core_alloc("test", 64<<10);
- splash(HZ/2, (handle > 0) ? "Success":"Fail");
- /* for some reason simplelist doesn't allow adding items here if
- * info.get_name is given, so use normal list api */
- gui_synclist_set_nb_items(list, core_get_num_blocks());
- if (handle > 0)
- core_free(handle);
+ if (gui_synclist_get_sel_pos(list) == 0 && core_test_free())
+ {
+ splash(HZ, "Freed test handle. New alloc should trigger compact");
+ }
+ else
+ {
+ splash(HZ/1, "Attempting a 64k allocation");
+ int handle = core_alloc("test", 64<<10);
+ splash(HZ/2, (handle > 0) ? "Success":"Fail");
+ /* for some reason simplelist doesn't allow adding items here if
+ * info.get_name is given, so use normal list api */
+ gui_synclist_set_nb_items(list, core_get_num_blocks());
+ if (handle > 0)
+ core_free(handle);
+ }
action = ACTION_REDRAW;
}
else if (action == ACTION_NONE)