heaph.inc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by the Free Pascal development team
  5. Heap manager interface section
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { Memorymanager }
  13. type
  14. PMemoryManager = ^TMemoryManager;
  15. TMemoryManager = record
  16. Getmem : procedure(Var p:pointer;Size:Longint);
  17. Freemem : procedure(Var p:pointer;Size:Longint);
  18. end;
  19. procedure GetMemoryManager(var MemMgr: TMemoryManager);
  20. procedure SetMemoryManager(const MemMgr: TMemoryManager);
  21. function IsMemoryManagerSet: Boolean;
  22. Procedure SysGetmem(Var p:pointer;Size:Longint);
  23. Procedure SysFreemem(Var p:pointer;Size:Longint);
  24. { Variables }
  25. const
  26. heapblocks : boolean=true;
  27. growheapsize : longint=$100000;
  28. var
  29. heaporg,heapptr,heapend,heaperror,freelist : pointer;
  30. { Basic (TP7) functions }
  31. Procedure getmem(Var p:pointer;Size:Longint);
  32. Procedure freemem(Var p:pointer;Size:Longint);
  33. Function memavail:Longint;
  34. Function maxavail:Longint;
  35. Procedure mark(var p : pointer);
  36. Procedure release(var p : pointer);
  37. { Fpc Functions }
  38. Function heapsize : longint;
  39. Procedure markheap(var oldfreelist,oldheapptr : pointer);
  40. Procedure releaseheap(oldfreelist,oldheapptr : pointer);
  41. {$ifdef TEMPHEAP}
  42. { Temp Heap Functions }
  43. const
  44. allow_special : boolean =true;
  45. Procedure split_heap;
  46. Procedure switch_to_base_heap;
  47. Procedure switch_to_temp_heap;
  48. Procedure switch_heap;
  49. Procedure releasetempheap;
  50. Procedure gettempmem(var p : pointer;size : longint);
  51. {$endif TEMPHEAP}
  52. {
  53. $Log$
  54. Revision 1.7 1998-10-01 14:55:18 peter
  55. + memorymanager like delphi
  56. Revision 1.6 1998/09/08 15:03:27 peter
  57. * moved getmem/freemem/memavail/maxavail to heaph.inc
  58. Revision 1.5 1998/07/02 14:11:30 michael
  59. Reinstated the heapsize function.
  60. Revision 1.3 1998/05/12 10:42:45 peter
  61. * moved getopts to inc/, all supported OS's need argc,argv exported
  62. + strpas, strlen are now exported in the systemunit
  63. * removed logs
  64. * removed $ifdef ver_above
  65. Revision 1.2 1998/04/21 10:23:15 peter
  66. + heapblocks
  67. }