heaph.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 unsplit_heap;
  47. Procedure switch_to_base_heap;
  48. Procedure switch_to_temp_heap;
  49. Procedure switch_heap;
  50. Procedure releasetempheap;
  51. Procedure gettempmem(var p : pointer;size : longint);
  52. {$endif TEMPHEAP}
  53. {
  54. $Log$
  55. Revision 1.8 1999-02-08 09:31:40 florian
  56. * fixed small things regarding TEMPHEAP
  57. Revision 1.7 1998/10/01 14:55:18 peter
  58. + memorymanager like delphi
  59. Revision 1.6 1998/09/08 15:03:27 peter
  60. * moved getmem/freemem/memavail/maxavail to heaph.inc
  61. Revision 1.5 1998/07/02 14:11:30 michael
  62. Reinstated the heapsize function.
  63. Revision 1.3 1998/05/12 10:42:45 peter
  64. * moved getopts to inc/, all supported OS's need argc,argv exported
  65. + strpas, strlen are now exported in the systemunit
  66. * removed logs
  67. * removed $ifdef ver_above
  68. Revision 1.2 1998/04/21 10:23:15 peter
  69. + heapblocks
  70. }