heapmgr.pp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2011 by the Free Pascal development team.
  4. Heap manager for the FPC embedded target
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$mode objfpc}
  12. Unit heapmgr;
  13. interface
  14. implementation
  15. var
  16. Memorymanager: TMemoryManager;external name 'FPC_SYSTEM_MEMORYMANAGER';
  17. Procedure HandleError (Errno : longint);external name 'FPC_HANDLEERROR';
  18. {*****************************************************************************
  19. OS Memory allocation / deallocation
  20. ****************************************************************************}
  21. function SysOSAlloc(size: ptruint): pointer;
  22. begin
  23. result:=nil; // pointer($02000000);
  24. end;
  25. procedure SysOSFree(p: pointer; size: ptruint);
  26. begin
  27. end;
  28. {$define FPC_IN_HEAPMGR}
  29. {$i heap.inc}
  30. const
  31. MyMemoryManager: TMemoryManager = (
  32. NeedLock: false; // Obsolete
  33. GetMem: @SysGetMem;
  34. FreeMem: @SysFreeMem;
  35. FreeMemSize: @SysFreeMemSize;
  36. AllocMem: @SysAllocMem;
  37. ReAllocMem: @SysReAllocMem;
  38. MemSize: @SysMemSize;
  39. InitThread: nil;
  40. DoneThread: nil;
  41. RelocateHeap: nil;
  42. GetHeapStatus: @SysGetHeapStatus;
  43. GetFPCHeapStatus: @SysGetFPCHeapStatus;
  44. );
  45. initialization
  46. SetMemoryManager(MyMemoryManager);
  47. InitHeap;
  48. finalization
  49. FinalizeHeap;
  50. end.