[FL-2432], [FL-2487] Rework bt keys load and save (#1139)
* bt keys: rework load and save with saved_struct * bt: rename bt keys storage functions * furi_hal_nfc: allow context switch during emilation * bt settings: rework with saved struct * infrared: replace file worker with dialogs and storage * Core, Loader: fix thread allocation tracking, much better, so wow. Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -239,26 +239,11 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
||||
event.type = LoaderEventTypeApplicationStarted;
|
||||
furi_pubsub_publish(loader_instance->pubsub, &event);
|
||||
furi_hal_power_insomnia_enter();
|
||||
|
||||
// Snapshot current memory usage
|
||||
instance->free_heap_size = memmgr_get_free_heap();
|
||||
} else if(thread_state == FuriThreadStateStopped) {
|
||||
/*
|
||||
* Current Leak Sanitizer assumes that memory is allocated and freed
|
||||
* inside one thread. Timers are allocated in one task, but freed in
|
||||
* Timer-Task thread, and xTimerDelete() just put command to queue.
|
||||
* To avoid some bad cases there are few fixes:
|
||||
* 1) delay for Timer to process commands
|
||||
* 2) there are 'heap diff' which shows difference in heap before task
|
||||
* started and after task completed. In process of leakage monitoring
|
||||
* both values should be taken into account.
|
||||
*/
|
||||
furi_hal_delay_ms(20);
|
||||
int heap_diff = instance->free_heap_size - memmgr_get_free_heap();
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
"Application thread stopped. Heap allocation balance: %d. Thread allocation balance: %d.",
|
||||
heap_diff,
|
||||
"Application thread stopped. Free heap: %d. Thread allocation balance: %d.",
|
||||
memmgr_get_free_heap(),
|
||||
furi_thread_get_heap_size(instance->application_thread));
|
||||
|
||||
if(loader_instance->application_arguments) {
|
||||
|
@@ -30,7 +30,6 @@ struct Loader {
|
||||
Submenu* debug_menu;
|
||||
Submenu* settings_menu;
|
||||
|
||||
size_t free_heap_size;
|
||||
volatile uint8_t lock_count;
|
||||
|
||||
FuriPubSub* pubsub;
|
||||
|
Reference in New Issue
Block a user