forked from bloomberg/pystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgc.h
More file actions
85 lines (72 loc) · 1.79 KB
/
gc.h
File metadata and controls
85 lines (72 loc) · 1.79 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include "object.h"
namespace pystack {
constexpr int NUM_GENERATIONS = 3;
/* Running stats per generation */
struct gc_generation_stats
{
Py_ssize_t collections;
Py_ssize_t collected;
Py_ssize_t uncollectable;
};
namespace Python3_7 {
typedef union _gc_head {
struct
{
union _gc_head* gc_next;
union _gc_head* gc_prev;
Py_ssize_t gc_refs;
} gc;
long double dummy; /* force worst-case alignment */
} PyGC_Head;
struct gc_generation
{
PyGC_Head head;
int threshold; /* collection threshold */
int count; /* count of allocations or collections of younger
generations */
};
struct _gc_runtime_state
{
PyObject* trash_delete_later;
int trash_delete_nesting;
int enabled;
int debug;
struct gc_generation generations[NUM_GENERATIONS];
PyGC_Head* generation0;
struct gc_generation permanent_generation;
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
int collecting;
};
} // namespace Python3_7
namespace Python3_8 {
typedef struct
{
uintptr_t _gc_next;
uintptr_t _gc_prev;
} PyGC_Head;
struct gc_generation
{
PyGC_Head head;
int threshold; /* collection threshold */
int count; /* count of allocations or collections of younger
generations */
};
struct _gc_runtime_state
{
PyObject* trash_delete_later;
int trash_delete_nesting;
int enabled;
int debug;
struct gc_generation generations[NUM_GENERATIONS];
PyGC_Head* generation0;
struct gc_generation permanent_generation;
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
int collecting;
PyObject* garbage;
PyObject* callbacks;
Py_ssize_t long_lived_total;
Py_ssize_t long_lived_pending;
};
} // namespace Python3_8
} // namespace pystack