The new heap code keeps a flag internally that goes true when any malloc fails (DMA or no-DMA).  Systemmod queries that during init and also queries it periodically at run time and will raise the critical memory alarm.

The heap check function is called: ````PIOS_heap_malloc_failed_p()````
This is queried in ````systemmod.c::updateSystemAlarms()````

So, you already have it :)