Add support for valgrind hints to glib (GSlice)
Submitted by Behdad Esfahbod
Assigned to Tim Janik
Link to original bug (#335126)
Description
Attaching draft patch that adds support for valgrind hints to gslice.
As recommended by valgrind docs, the two needed header files are copied into glib/glib/valgrind. The patch itself is pretty simple, it marks memory chunks that gslice allocates as unaccessible and in g_slice_alloc/alloc0/free marks the slices appropriately. It also uses the residual of size (chunk_size - mem_size) at the end of slices as red zones.
The runtime overhead is negligible. Should be harmless to have on all the time, but we probably want to disable them with debug=off (only).