Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

lua make memcheck script eat all available ram (incld audiobuf)

Change-Id: Ia202c9097324985a3a9a9c96be8422c38e79cb3e

authored by

William Wilgus and committed by
William Wilgus
0a88b818 962e1b2e

+31 -6
+31 -6
apps/plugins/lua_scripts/memchk.lua
··· 16 16 KIND, either express or implied. 17 17 ]]-- 18 18 19 + local a = {} 20 + loops = 1 --global 21 + 22 + local function alloc_tables(loops) 23 + for i=1,loops do a[i] = {{}}; local b = {} end 24 + return true 25 + end 26 + 27 + local ret 28 + local status = true 29 + rb.lcd_putsxy(0, 0, "memchk loops : ") 30 + while (status and loops < 1000) 31 + do 32 + rb.lcd_putsxy(0, 20, loops) 33 + rb.lcd_update() 34 + alloc_tables(loops) 35 + -- do call protected to catch OOM condition 36 + status, ret = pcall(alloc_tables, loops * 1000) 37 + loops = loops + 1 38 + _G.loops = loops 39 + end 40 + 19 41 local used, allocd, free = rb.mem_stats() 20 42 local lu = collectgarbage("count") 21 43 local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end ··· 23 45 -- this is how lua recommends to concat strings rather than .. 24 46 local s_t = {} 25 47 s_t[1] = "rockbox:\n" 26 - s_t[2] = fmt("Used ", used) 27 - s_t[3] = fmt("Allocd ", allocd) 28 - s_t[4] = fmt("Free ", free) 29 - s_t[5] = "\nlua:\n" 30 - s_t[6] = fmt("Used", lu * 1024) 31 - s_t[7] = "\n\nNote that the rockbox used count is a high watermark" 48 + s_t[2] = "Loops : " 49 + s_t[3] = loops - 1 50 + s_t[4] = "\n" 51 + s_t[5] = fmt("Used ", used) 52 + s_t[6] = fmt("Allocd ", allocd) 53 + s_t[7] = fmt("Free ", free) 54 + s_t[8] = "\nlua:\n" 55 + s_t[9] = fmt("Used", lu * 1024) 56 + s_t[10] = "\n\nNote that the rockbox used count is a high watermark\n" 32 57 rb.splash_scroller(10 * rb.HZ, table.concat(s_t))