MemoryStats.cs 397 B

123456789101112131415161718192021222324252627
  1. using System.Threading;
  2. namespace Hebron.Runtime
  3. {
  4. internal unsafe static class MemoryStats
  5. {
  6. private static int _allocations;
  7. public static int Allocations
  8. {
  9. get
  10. {
  11. return _allocations;
  12. }
  13. }
  14. internal static void Allocated()
  15. {
  16. Interlocked.Increment(ref _allocations);
  17. }
  18. internal static void Freed()
  19. {
  20. Interlocked.Decrement(ref _allocations);
  21. }
  22. }
  23. }