checkmem.pas 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Pierre Muller
  4. This unit is just used to check that all memory is freed
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************}
  17. Unit CheckMem;
  18. {$i fpcdefs.inc}
  19. Interface
  20. Implementation
  21. Const
  22. EntryMemUsed : longint = 0;
  23. Procedure CheckMemory(LostMemory : longint);
  24. var
  25. st : string;
  26. begin
  27. if LostMemory<>0 then
  28. begin
  29. str(LostMemory,st);
  30. Writeln('Memory Lost = ',st);
  31. end;
  32. end;
  33. initialization
  34. EntryMemUsed:=system.HeapSize-MemAvail;
  35. finalization
  36. CheckMemory(system.HeapSize-MemAvail-EntryMemUsed);
  37. end.
  38. {
  39. $Log$
  40. Revision 1.3 2003-04-22 14:33:38 peter
  41. * removed some notes/hints
  42. Revision 1.2 2002/11/15 12:23:49 peter
  43. * new unit
  44. }