File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 12
12
13
13
14
14
class AllocationType (Enum ):
15
+ # integer values match memray AllocatorType
15
16
MALLOC = 1
16
17
FREE = 2
17
18
CALLOC = 3
18
19
REALLOC = 4
20
+ MMAP = 10
21
+ MUNMAP = 11
19
22
20
23
21
24
@dataclass ()
@@ -75,6 +78,8 @@ def get_allocations_over_threshold(result_file, mem_threshold):
75
78
allocation_type = AllocationType .CALLOC
76
79
elif a .allocator == memray .AllocatorType .REALLOC :
77
80
allocation_type = AllocationType .REALLOC
81
+ elif a .allocator == memray .AllocatorType .MMAP :
82
+ allocation_type = AllocationType .MMAP
78
83
else :
79
84
raise ValueError (f"Unsupported memray.AllocatorType { a .allocator } " )
80
85
allocation = Allocation (
@@ -88,13 +93,19 @@ def get_allocations_over_threshold(result_file, mem_threshold):
88
93
address_to_allocation [a .address ] = allocation
89
94
yield allocation
90
95
elif (
91
- a .allocator == memray .AllocatorType .FREE
96
+ a .allocator in ( memray .AllocatorType .FREE , memray . AllocatorType . MUNMAP )
92
97
and a .address in address_to_allocation
93
98
):
99
+ if a .allocator == memray .AllocatorType .FREE :
100
+ allocation_type = AllocationType .FREE
101
+ elif a .allocator == memray .AllocatorType .MUNMAP :
102
+ allocation_type = AllocationType .MUNMAP
103
+ else :
104
+ raise ValueError (f"Unsupported memray.AllocatorType { a .allocator } " )
94
105
allocation = address_to_allocation .pop (a .address )
95
106
yield Allocation (
96
107
allocation .object_id ,
97
- AllocationType . FREE ,
108
+ allocation_type ,
98
109
allocation .memory ,
99
110
address = a .address ,
100
111
)
You can’t perform that action at this time.
0 commit comments