Consider removing pfs_get_core_commands_sorted_by_name_dynamic and other *_dynamic functions and sort command (and subcommands) on dynamically allocated array of commands during the shell initialization to avoid constant heap fragmentation.
Consider removing built-in qsort and write more light implementation of sorting algorithm.