Bug 119663 - option to use wildcard or regex to match alloc-fn symbols
Summary: option to use wildcard or regex to match alloc-fn symbols
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: massif (other bugs)
Version First Reported In: 3.1.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Nicholas Nethercote
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-07 05:20 UTC by Mark Gilbert
Modified: 2023-10-19 03:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Patch adding --alloc-pattern (2.16 KB, patch)
2006-10-19 08:47 UTC, Devin Carraway
Details
Patch adding --alloc-pattern (revised) (2.16 KB, patch)
2006-10-19 09:05 UTC, Devin Carraway
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Gilbert 2006-01-07 05:20:21 UTC
Version:           3.1.0 (using KDE Devel)
Installed from:    Compiled sources

When profiling large applications with numerous dependancies and ancillaries, it's very tedious to list out --alloc-fn entries one by one, even in the cases where they can simply be written once to .valgrindrc.  For example, the only time I ever care about glib functions in any sense other than as allocs is when I'm profiling glib itself.  Otherwise, I'd much rather use --alloc-fn="^g_" than write out scores of g_* functions, the other g_* functions they call, the other g_* functions that those call, and eventually in turn the base allocators like g_malloc.  As another example, when multiple non-utility function libraries are in use (like, say, freetype and glib) as dependancies of the application of interest, with regex matching turned on I could just use --alloc-fn='alloc' or with wildcard matching --alloc-fn='*alloc*' to match g_malloc0 and ft_malloc alike.
Comment 1 Devin Carraway 2006-10-19 08:47:40 UTC
Created attachment 18187 [details]
Patch adding --alloc-pattern
Comment 2 Devin Carraway 2006-10-19 08:50:12 UTC
Patch attached to accomplish this.  The harcoded limit of 32 alloc functions is inadequate for many C++ programs using STL containers, besides the considerable nuisance of having to find and list them all by trial and error.
Comment 3 Devin Carraway 2006-10-19 09:05:53 UTC
Created attachment 18188 [details]
Patch adding --alloc-pattern (revised)

Slight fix to previous patch, removes a deliberate break of the operator new
pattern I had put in for debugging
Comment 4 Paul Floyd 2023-10-19 03:16:05 UTC
Firstly the code now uses XArrays so the size is no longer fixed.

Secondly the “new*” wildcard is a really bad idea. It will match placement new which most definitely is not an allocating function. 

Having said that there are clearly many missing allocators in the list.