Skip to content

Commit

Permalink
[#393]Add Valgrind support
Browse files Browse the repository at this point in the history
  • Loading branch information
ashu3103 committed Jan 30, 2024
1 parent cc10abc commit df22b16
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 0 deletions.
16 changes: 16 additions & 0 deletions contrib/valgrind/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Valgrind

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.

# Run memory management detection

``` bash
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
```

# Generate valgrind report with suppressed rules

``` bash
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
```

170 changes: 170 additions & 0 deletions contrib/valgrind/pgagroal.supp
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
#
# pgagroal rules (Functions that are invoked directly from main)
#

{
pgagroal_bind_host
Memcheck:Leak
match-leak-kinds: reachable
fun:calloc
fun:bind_host
fun:pgagroal_bind
fun:main
}

{
pgagroal_set_proc_title_calloc
Memcheck:Leak
match-leak-kinds: indirect
fun:calloc
fun:pgagroal_set_proc_title
fun:main
}

{
pgagroal_set_proc_title_malloc
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:pgagroal_set_proc_title
fun:main
}

#
# non-pgagroal rules
#

{
ev_loop_periodics_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:feed_reverse
fun:periodics_reify
fun:ev_run.cold
fun:ev_loop
fun:main
}

{
ev_loop_timers_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:feed_reverse
fun:timers_reify
fun:ev_run.cold
fun:ev_loop
fun:main
}

{
ev_io_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:fd_change
fun:ev_io_start.cold
fun:evtimerfd_init
fun:ev_periodic_start.cold
fun:main
}

{
ev_io_management_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_io_start.cold
fun:start_management
fun:main
}

{
ev_io_uds_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_io_start.cold
fun:start_uds
fun:main
}

{
ev_io_metrics_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_io_start.cold
fun:start_metrics
fun:main
}

{
ev_periodics_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_feed_event.cold
fun:feed_reverse_done
fun:periodics_reify
fun:ev_run
fun:ev_loop
fun:main
}

{
ev_periodics_start_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_periodic_start.cold
fun:main
}

{
ev_epoll_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:epoll_init
fun:loop_init
fun:ev_default_loop
fun:main
}

{
ev_fd_event_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:ev_feed_event.cold
fun:fd_event_nocheck
fun:fd_event
fun:epoll_poll
fun:ev_run
fun:ev_loop
fun:main
}

{
ev_fd_change_realloc
Memcheck:Leak
match-leak-kinds: reachable
fun:realloc
fun:ev_realloc
fun:fd_change
fun:ev_io_start.cold
...
fun:main
}

0 comments on commit df22b16

Please sign in to comment.