1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 21:05:26 +03:00

Projectkk2glider/lua bitmap free (#4075)

* Better memory stats (CLI)

* Bitmap buffer overflow check added

* Lua bitmap improvements

* Proper handling of symbolic links in simulator

* S6R Lua script fixes:
 * added progress screen while loading bitmaps
 * memory for bitmaps is now freed when leaving the script

* S6R Lua script: improved bitmap loading

* * Lua Themes and Widgets moved to separate file and separate Lua state
* Stand-alone, mixer and function scripts now behave the same as on Taranis (restarted after the stand-alone script was run)
* both Lua states are independent: Themes and Widgets is initialized only at the start, the other one is initialized before and after the stand-alone script is run

* Better leak test and report in BitmapBuffer

* Re #3318: Lua compiler enabled in simu and Companion simulator. Usage:
 * any time <xxx>.lua file is about to be loaded and if file <xxx>.lua.src exists:
   * load contents of <xxx>.lua.src
   * compile Lua code
   * save compiled code into <xxx>.lua (effectively overwrites existing file)
 * immediately following the compilation the real file loading is done from <xxx>.lua (which by now contains compiled Lua bytecode)
This commit is contained in:
Damjan Adamic 2016-11-28 23:08:18 +01:00 committed by Bertrand Songis
parent ae383cd6a4
commit 92553b6589
18 changed files with 745 additions and 554 deletions

View file

@ -303,6 +303,10 @@ int cliStackInfo(const char ** argv)
return 0;
}
extern int _end;
extern int _heap_end;
extern unsigned char *heap;
int cliMemoryInfo(const char ** argv)
{
// struct mallinfo {
@ -318,11 +322,25 @@ int cliMemoryInfo(const char ** argv)
// int keepcost; /* top-most, releasable (via malloc_trim) space */
// };
struct mallinfo info = mallinfo();
serialPrint("arena %d", info.arena);
serialPrint("ordblks %d", info.ordblks);
serialPrint("uordblks %d", info.uordblks);
serialPrint("fordblks %d", info.fordblks);
serialPrint("keepcost %d", info.keepcost);
serialPrint("mallinfo:");
serialPrint("\tarena %d bytes", info.arena);
serialPrint("\tordblks %d bytes", info.ordblks);
serialPrint("\tuordblks %d bytes", info.uordblks);
serialPrint("\tfordblks %d bytes", info.fordblks);
serialPrint("\tkeepcost %d bytes", info.keepcost);
serialPrint("\nHeap:");
serialPrint("\tstart %p", (unsigned char *)&_end);
serialPrint("\tend %p", (unsigned char *)&_heap_end);
serialPrint("\tcurr %p", heap);
serialPrint("\tused %d bytes", (int)(heap - (unsigned char *)&_end));
serialPrint("\tfree %d bytes", (int)((unsigned char *)&_heap_end - heap));
serialPrint("\nLua:");
serialPrint("\tScripts %d", luaGetMemUsed(lsScripts));
#if defined(PCBHORUS)
serialPrint("\tWidgets %d", luaGetMemUsed(lsWidgets));
#endif
return 0;
}