Welcome to mirror list, hosted at ThFree Co, Russian Federation.

object_tracker.hpp « base - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f38f4dd705862c6fa089e420ca2807a33f08da04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "base.hpp"
#include "mutex.hpp"

#include "../std/map.hpp"


#define TRACKER_MULTITHREADED

namespace dbg
{
  class ObjectTracker
  {
    /// Pointer -> Info (Serial number of creation)
    static map<void *, size_t> m_map;
    static size_t m_counter;

#ifdef TRACKER_MULTITHREADED
    static threads::Mutex m_mutex;
#endif

    static void Add(void *);
    static void Remove(void *);

  public:
    ObjectTracker();
    ObjectTracker(ObjectTracker const & rhs);
    ~ObjectTracker();

    static void PrintLeaks();
  };

  void BreakIntoDebugger();
}