malt icon indicating copy to clipboard operation
malt copied to clipboard

Support of suppression files

Open fcoiffie opened this issue 6 years ago • 4 comments

Is there a way to exclude some detected memory leaks by ignoring some symbols ?

For Valgrind, it is called suppression files: http://valgrind.org/docs/manual/manual-core.html#manual-core.suppress There is often small memory leaks in 3rd libraries which cannot be easily corrected.

fcoiffie avatar Feb 21 '19 10:02 fcoiffie

Not yet but can be done quite easily.

Maybe I can provide a file similarly to valgrind.

Originally I was thinking to be able to do it in the GUI but both can be nice so I will to your proposition as it is easy to do.

Thanks for providing idea.

svalat avatar Feb 21 '19 18:02 svalat

Yesterday, I check (quickly) the source code. It seems that the "leaks" section in the JSON isn't used by malt-webview to display leaks (in calltree panel). Finaly, I quickly filtered the stackTracker (when a Stack contains the symbol I want to ignore) in AllocStackProfiler. It works for several symbols but sometimes I can't find some symbols (but there are displayed in malt-webview).

fcoiffie avatar Feb 22 '19 10:02 fcoiffie

Sorry was traveling out past weeks, will work on this maybe next week or week after. Thanks for the feedback will look.

But I think there is currently a symbol location extraction which might be buggy on many Linux disto enabling -fPIE + ASLR (https://github.com/memtt/malt/issues/23), I'm on and might have fix in coming days. Maybe this is the symbol issue you are speeking about.

Is your project open source so I can look on it directly ?

svalat avatar Apr 11 '19 22:04 svalat

About the filtering, is it OK if I will proceed like this :

  • Use a INI or JSON formatted file to define suppression. (INI would be if I go for backend suppresion, but I think I will prefer GUI side one).
  • Permit to suppress full object file (.so file.....) allowing wildcard allowed
  • Permit to suppress objct name in C++ if demangling is valid again with wildcard allowed
  • Permit to suppress function name again with wildcard allowed
  • Permit to suppress full symbol name again with wildcard allowed.
  • Permit to suppress a line range

I would think naively something like this (still need to think more but that looks a nice first spec):

{
	"MySoFile-strict": {
		"object": "libMySoFile.so.1.2"
	},
	"MySoFile-wildcard": {
		"object": "libMySoFileWithWildCard.so.*"
	},

	"MySourcePath-strict": {
		"source": "/src/driver/tcp.cpp"
	},
	"MySourcePath-wildcard": {
		"source": "/src/driver/*.cpp"
	},

	"MyClass-strict": {
		"class": "MyDriverTCP"
	},
	"MyClass-wildcard": {
		"class": "MyDriver*"
	},

	"MyFunc-strict": {
		"function": "doConnectTCP"
	},
	"MyFunc-wildcard": {
		"function": "doConnect*"
	},

	"MySymbol-strict": {
		"function": "MyClass::doConnectTCP"
	},
	"MySymbol-wildcard": {
		"function": "MyClass::doConnect*"
	},

	"ExludeLines": {
		"source": "/src/driver/tcp.cpp",
		"line": [20-34],
	},

	"All-joint-to-strictly-specify": {
		"object": "libMySoFile.so.1.2",
		"source": "/src/driver/tcp.cpp",
		"class": "MyDriverTCP",
		"function": "doConnectTCP",
		"line": [20-34],
	}
}

Any comment ?

svalat avatar Apr 11 '19 23:04 svalat