l_mem.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, 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 Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. //=============================================================================
  19. // memory.h
  20. //#define MEMDEBUG
  21. #undef MEMDEBUG
  22. #ifndef MEMDEBUG
  23. void *GetClearedMemory(int size);
  24. void *GetMemory(unsigned long size);
  25. #else
  26. #define GetMemory(size) GetMemoryDebug(size, #size, __FILE__, __LINE__);
  27. #define GetClearedMemory(size) GetClearedMemoryDebug(size, #size, __FILE__, __LINE__);
  28. //allocate a memory block of the given size
  29. void *GetMemoryDebug(unsigned long size, char *label, char *file, int line);
  30. //allocate a memory block of the given size and clear it
  31. void *GetClearedMemoryDebug(unsigned long size, char *label, char *file, int line);
  32. //
  33. void PrintMemoryLabels(void);
  34. #endif //MEMDEBUG
  35. void FreeMemory(void *ptr);
  36. int MemorySize(void *ptr);
  37. void PrintMemorySize(unsigned long size);
  38. int TotalAllocatedMemory(void);