Skip to content

Commit df22b16

Browse files
committed
[agroal#393]Add Valgrind support
1 parent cc10abc commit df22b16

File tree

2 files changed

+186
-0
lines changed

2 files changed

+186
-0
lines changed

contrib/valgrind/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Valgrind
2+
3+
The [Valgrind](https://valgrind.org/) tool suite provides a number of debugging and profiling tools that help you make your programs faster and more correct. The most popular and the default of these tools is called **Memcheck**. It can detect many memory-related errors that can lead to crashes and unpredictable behaviour.
4+
5+
# Run memory management detection
6+
7+
``` bash
8+
valgrind --leak-check=full --show-leak-kinds=all --log-file=%p.log --trace-children=yes --track-origins=yes --read-var-info=yes ./pgagroal -c pgagroal.conf -a pgagroal_hba.conf
9+
```
10+
11+
# Generate valgrind report with suppressed rules
12+
13+
``` bash
14+
valgrind --suppressions=../../contrib/valgrind/pgagroal.supp --leak-check=full --show-leak-kinds=all --log-file=%p.log --trace-children=yes --track-origins=yes --read-var-info=yes ./pgagroal -c pgagroal.conf -a pgagroal_hba.conf
15+
```
16+

contrib/valgrind/pgagroal.supp

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
#
2+
# pgagroal rules (Functions that are invoked directly from main)
3+
#
4+
5+
{
6+
pgagroal_bind_host
7+
Memcheck:Leak
8+
match-leak-kinds: reachable
9+
fun:calloc
10+
fun:bind_host
11+
fun:pgagroal_bind
12+
fun:main
13+
}
14+
15+
{
16+
pgagroal_set_proc_title_calloc
17+
Memcheck:Leak
18+
match-leak-kinds: indirect
19+
fun:calloc
20+
fun:pgagroal_set_proc_title
21+
fun:main
22+
}
23+
24+
{
25+
pgagroal_set_proc_title_malloc
26+
Memcheck:Leak
27+
match-leak-kinds: definite
28+
fun:malloc
29+
fun:pgagroal_set_proc_title
30+
fun:main
31+
}
32+
33+
#
34+
# non-pgagroal rules
35+
#
36+
37+
{
38+
ev_loop_periodics_realloc
39+
Memcheck:Leak
40+
match-leak-kinds: reachable
41+
fun:realloc
42+
fun:ev_realloc
43+
fun:feed_reverse
44+
fun:periodics_reify
45+
fun:ev_run.cold
46+
fun:ev_loop
47+
fun:main
48+
}
49+
50+
{
51+
ev_loop_timers_realloc
52+
Memcheck:Leak
53+
match-leak-kinds: reachable
54+
fun:realloc
55+
fun:ev_realloc
56+
fun:feed_reverse
57+
fun:timers_reify
58+
fun:ev_run.cold
59+
fun:ev_loop
60+
fun:main
61+
}
62+
63+
{
64+
ev_io_realloc
65+
Memcheck:Leak
66+
match-leak-kinds: reachable
67+
fun:realloc
68+
fun:ev_realloc
69+
fun:fd_change
70+
fun:ev_io_start.cold
71+
fun:evtimerfd_init
72+
fun:ev_periodic_start.cold
73+
fun:main
74+
}
75+
76+
{
77+
ev_io_management_realloc
78+
Memcheck:Leak
79+
match-leak-kinds: reachable
80+
fun:realloc
81+
fun:ev_realloc
82+
fun:ev_io_start.cold
83+
fun:start_management
84+
fun:main
85+
}
86+
87+
{
88+
ev_io_uds_realloc
89+
Memcheck:Leak
90+
match-leak-kinds: reachable
91+
fun:realloc
92+
fun:ev_realloc
93+
fun:ev_io_start.cold
94+
fun:start_uds
95+
fun:main
96+
}
97+
98+
{
99+
ev_io_metrics_realloc
100+
Memcheck:Leak
101+
match-leak-kinds: reachable
102+
fun:realloc
103+
fun:ev_realloc
104+
fun:ev_io_start.cold
105+
fun:start_metrics
106+
fun:main
107+
}
108+
109+
{
110+
ev_periodics_realloc
111+
Memcheck:Leak
112+
match-leak-kinds: reachable
113+
fun:realloc
114+
fun:ev_realloc
115+
fun:ev_feed_event.cold
116+
fun:feed_reverse_done
117+
fun:periodics_reify
118+
fun:ev_run
119+
fun:ev_loop
120+
fun:main
121+
}
122+
123+
{
124+
ev_periodics_start_realloc
125+
Memcheck:Leak
126+
match-leak-kinds: reachable
127+
fun:realloc
128+
fun:ev_realloc
129+
fun:ev_periodic_start.cold
130+
fun:main
131+
}
132+
133+
{
134+
ev_epoll_realloc
135+
Memcheck:Leak
136+
match-leak-kinds: reachable
137+
fun:realloc
138+
fun:ev_realloc
139+
fun:epoll_init
140+
fun:loop_init
141+
fun:ev_default_loop
142+
fun:main
143+
}
144+
145+
{
146+
ev_fd_event_realloc
147+
Memcheck:Leak
148+
match-leak-kinds: reachable
149+
fun:realloc
150+
fun:ev_realloc
151+
fun:ev_feed_event.cold
152+
fun:fd_event_nocheck
153+
fun:fd_event
154+
fun:epoll_poll
155+
fun:ev_run
156+
fun:ev_loop
157+
fun:main
158+
}
159+
160+
{
161+
ev_fd_change_realloc
162+
Memcheck:Leak
163+
match-leak-kinds: reachable
164+
fun:realloc
165+
fun:ev_realloc
166+
fun:fd_change
167+
fun:ev_io_start.cold
168+
...
169+
fun:main
170+
}

0 commit comments

Comments
 (0)