<div dir="ltr"><div>Trying to detect at unit initialization if a memory manager has been installed (xtensa-freertos) fails on FreeRTOS target.  It appears that IsMemoryManagerSet[1] always returns false for this target, even if a custom memory manager has been installed.  Looking at the implementation of IsMemoryManagerSet shows that it will always return false if either HAS_MEMORYMANAGER or FPC_NO_DEFAULT_MEMORYMANAGER is defined, if none of these are defined, it will check if the getmem & freememare different to the system defined routines.</div><div><br></div><div>For FreeRTOS both HAS_MEMORYMANAGER and  FPC_NO_DEFAULT_MEMORYMANAGER are defined, so it is impossible to detect if a custom memory manager has been installed using IsMemoryManagerSet.</div><div><br></div><div>a) Am I using the correct approach to detect if a memory manager is installed?  I want to check if it is safe to use GetMem/FreeMem.<br></div><div>b) Is there a reason for the behaviour of IsMemoryManagerSet?  <br></div><div><br></div><div>[1] From rtl/inc/heap.inc:<br></div><div>function IsMemoryManagerSet:Boolean;<br>begin<br>{$ifdef HAS_MEMORYMANAGER}<br>  Result:=false;<br>{$else HAS_MEMORYMANAGER}<br>{$ifdef FPC_NO_DEFAULT_MEMORYMANAGER}<br>  Result:=false;<br>{$else not FPC_NO_DEFAULT_MEMORYMANAGER}<br>  IsMemoryManagerSet := (MemoryManager.GetMem<>@SysGetMem)<br>    or (MemoryManager.FreeMem<>@SysFreeMem);<br>{$endif notFPC_NO_DEFAULT_MEMORYMANAGER}<br>{$endif HAS_MEMORYMANAGER}<br>end;  <br></div></div>