Insufficient heap December 15, 2019
Sometimes an application wont run on a JNIOR Series 3 unit. This issue may be due to “insufficient heap“.
This error message means that there was not enough contiguous space in “heap” or the SRAM memory for the application. The application must find contiguous memory of at least the file size of the application. Once the application finds that space it will stay in that same space until the application is updated. The memory can become fragmented over time since the SRAM is used for application executables, application memory and the root file system.
Most likely this error condition will occur after updating to a new version of an application. If the new application is larger than the old application it cannot occupy the same contiguous block in memory. It must find a new contiguous block. That space may not be available depending on the fragmentation of the memory. Even if there is a contiguous block of memory large enough when the file is updated, it still might give you an “insufficient heap” error. This might happen because until its run as an executable, the file doesn’t know it needs to be stored as contiguous space and fragment its memory anyways, which would then cause the error.
The fragmentation is caused by file blocks that have become scattered throughout memory over time. To clear up the fragmentation we could delete a file at a time until a contiguous block has become available. This would be a very slow approach. You would not know which file gives you the best chance of finding a contiguous block. Since the root of the file system contains mostly log files we can just clear the heap on a reboot. In order to that we execute the reboot -a command.
What about my cinema devices and macros files?
The cinema files are automatically backed up to flash/cinema_backup. This location is not affected by the reboot -a. The cinema files will be restored next time cinema runs.