Code

Use subdirectories with icon sizes.
[inkscape.git] / src / debug / heap.cpp
1 /*
2  * Inkscape::Debug::Heap - interface for gathering heap statistics
3  *
4  * Authors:
5  *   MenTaLguY <mental@rydia.net>
6  *
7  * Copyright (C) 2005 MenTaLguY
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifdef HAVE_CONFIG_H
13 # include "config.h"
14 #endif
16 #include "gc-alloc.h"
17 #include "debug/gc-heap.h"
18 #include "debug/sysv-heap.h"
19 #include <vector>
21 namespace Inkscape {
22 namespace Debug {
24 namespace {
26 typedef std::vector<Heap *, GC::Alloc<Heap *, GC::MANUAL> > HeapCollection;
28 HeapCollection &heaps() {
29     static bool is_initialized=false;
30     static HeapCollection heaps;
31     if (!is_initialized) {
32         heaps.push_back(new SysVHeap());
33         heaps.push_back(new GCHeap());
34         is_initialized = true;
35     }
36     return heaps;
37 }
39 }
41 unsigned heap_count() {
42     return heaps().size();
43 }
45 Heap *get_heap(unsigned i) {
46     return heaps()[i];
47 }
49 void register_extra_heap(Heap &heap) {
50     heaps().push_back(&heap);
51 }
53 }
54 }
56 /*
57   Local Variables:
58   mode:c++
59   c-file-style:"stroustrup"
60   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
61   indent-tabs-mode:nil
62   fill-column:99
63   End:
64 */
65 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :