You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test validates that the Datadog Python profiler correctly profiles memory allocations.
4
+
5
+
## Test Application
6
+
7
+
- Creates a list of `None` of a target size (1e6 items)
8
+
- The list is then filled by two functions `allocate_memory_1` and `allocate_memory_2` that allocate
9
+
1024 bytes and 3 \* 1024 bytes respectively. The list is filled until the last item is not `None`.
10
+
11
+
## Expected Profile
12
+
13
+
### Samples
14
+
15
+
Those represent the number of times the function called the allocator. This is hard to estimate manually
16
+
because of how the sampling logic works
17
+
(see [here](https://github.com/datadog/dd-trace-py/blob/9af78604497d1993826c59c351e1a4e53f817783/ddtrace/profiling/collector/_memalloc_tb.cpp#L329-L360)),
18
+
but the numbers are stable.
19
+
20
+
-`^<module>;run;allocate_memory_1$` should be present and should account for 25% of the samples.
21
+
-`^<module>;run;allocate_memory_2$` should be present and should account for 45% of the samples.
22
+
-`^<module>;__init__;grow_list$` should be present and should account for 20% of the samples.
23
+
24
+
### Space
25
+
26
+
-`^<module>;run;allocate_memory_1$` should be present and should account for 25% of the space (1024 bytes)
27
+
-`^<module>;run;allocate_memory_2$` should be present and should account for 75% of the space (3 \* 1024 bytes)
28
+
-`^<module>;__init__;grow_list$` should be present and should account for 3% of the space
29
+
(list container, noise compared to the other allocations)
0 commit comments