Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Saalfeld
Beginner
136 Views

detecting leaks or invalid/uninitialized accesses... but not both

When I do an analysis with only "detect memory leaks" and "detect resource leaks" selected ... it detects the leaks just fine. However if I also select "detect invalid/uninitialized accesses" it then only detects invalid/uninitialized accesses and no longer detects leaks.
Am I missing something simple here?
0 Kudos
11 Replies
Kirill_R_Intel
Employee
136 Views

Hi Daniel,

I tried the same steps with two different projects, but couldn't reproduce your issue. If I add "detects invalid/uninitialized accesses" in addition to "detect memory leaks" and "detect resource leaks", all works as expected. Invalid access issues are found alongwith memory leaks.

If you can provide a sample reproducer project, I can test and diagnose it on my side. Also could you please provide more details about your setup:
- OS type and version
- Intel Inspector XE version (if it's not the latest update 4, you can consider to upgrade)
- Command line of your analysis. To get command line from GUI press "Show command line" button in the right bottom corner of the Inspector XE window.
- Any additional settings of your analysis, etc.

Regards,
Kirill
Daniel_Saalfeld
Beginner
136 Views

Hi Kirill,


I tried an extremely simplified project and Inspector worked as expected finding both access errors and leaks.
I was however able to produce another simplified project more closely resembling my real one that exhibits the same issue. I'm guessing it may have something to do with the fact that it uses a dll and/or is mfc based. I attached the example project to this reply.
In case the attachment doesn't work ... it is basically just a mfc application linked to a plain dll. Both are built by us and have debug info etc.
I was also incorrect stating that it didn't find any leaks ... it does find leaks, but only memory leaks in the main executable and not in the dll and no gdi leaks. (this is in leaks + access errors analysis)
So in summary...
Leaks only analysis : finds both memory and gdi leaks in exe and dll
Leaks + access errors : find access errors in both exe and dll, memory leaks in exe but not in dll, and no gdi leaks at all.
exe and dll should both have 1 access error, 1 gdi leak, and 1 memory leak.
OS: win7 pro 64-bit
Inspector version: update 4
Analysis settings are pretty much all default - just copied the memory leak analysis and checked the access errors as well.
command line:inspxe-cl -collect errors -mrte-mode=native -suppressions=delete --search-dir sym=C:/dev/9.0/GWB/React_gui -- c:\dev\9.0\GWB\React_gui\React.exe
The only other weirdness I noticed was that the leaks only analysis had a return code of 0, but the leaks + access analysis had a return code of -1073741819
Thanks for the help, and if there's any more information you need let me know.
~dan
edit: how in the world do you get these posts to actually put in a break between paragraphs? sorry for the wall of text ...
Kirill_R_Intel
Employee
136 Views

Thanks for the reproducer.

I've tried it in my lab and still can't reproduce the problem. Here what I'm doing:

1. I've performed two test: test 1 (memory & resource leaks) and and test 2 (test1 + access issues). Here are settings for the two tests:




Issues found for test1:



Issues found in test2:




Kirill_R_Intel
Employee
136 Views

So you can see that all problems found in test1 are found in test2 as well. The way I run your test program:
- configure and start analysis
- wait until program window appear
- wait for 5 seconds
- close the test program window

My setup is similar to yours: Windows* 7 64-bit, VS2008.
Daniel_Saalfeld
Beginner
136 Views

My test 2:
I've been running it the same way as you describe. Maybe it is an issue with some of the other dll's that get loaded? Maybe compare our collector messages?
Here are mine:
Memory error analysis: started
Result file:
Analysis started for c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\inspect_test.exe (pid = 6308)
Loaded module: c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\inspect_test.exe, address range [0x01260000-0x01295fff]
Loaded module: C:\Windows\system32\apphelp.dll, address range [0x74cb0000-0x74cfafff]
Loaded module: C:\Windows\system32\VERSION.dll, address range [0x75170000-0x75178fff]
Loaded module: C:\Windows\syswow64\KERNELBASE.dll, address range [0x75840000-0x75885fff]
Loaded module: C:\Windows\syswow64\kernel32.dll, address range [0x75930000-0x75a2ffff]
Loaded module: C:\Windows\syswow64\msvcrt.dll, address range [0x770d0000-0x7717bfff]
Loaded module: C:\Windows\SysWOW64\ntdll.dll, address range [0x778e0000-0x77a5ffff]
Loaded module: c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\dll.dll, address range [0x6a6a0000-0x6a6c7fff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugmfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_9b54853441e399d5\mfc90ud.dll, address range [0x5dc60000-0x5deabfff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\MSVCR90D.dll, address range [0x5e140000-0x5e262fff]
Loaded module: C:\Windows\syswow64\USER32.dll, address range [0x76fd0000-0x770cffff]
Loaded module: C:\Windows\syswow64\GDI32.dll, address range [0x76c50000-0x76cdffff]
Loaded module: C:\Windows\syswow64\LPK.dll, address range [0x76eb0000-0x76eb9fff]
Loaded module: C:\Windows\syswow64\USP10.dll, address range [0x75890000-0x7592cfff]
Loaded module: C:\Windows\syswow64\ADVAPI32.dll, address range [0x757a0000-0x7583ffff]
Loaded module: C:\Windows\SysWOW64\sechost.dll, address range [0x75e30000-0x75e48fff]
Loaded module: C:\Windows\syswow64\RPCRT4.dll, address range [0x75be0000-0x75ccffff]
Loaded module: C:\Windows\syswow64\SspiCli.dll, address range [0x75450000-0x754affff]
Loaded module: C:\Windows\syswow64\CRYPTBASE.dll, address range [0x75440000-0x7544bfff]
Loaded module: C:\Windows\syswow64\SHLWAPI.dll, address range [0x77380000-0x773d6fff]
Loaded module: C:\Windows\system32\MSIMG32.dll, address range [0x71060000-0x71064fff]
Loaded module: C:\Windows\syswow64\OLEAUT32.dll, address range [0x75cd0000-0x75d5efff]
Loaded module: C:\Windows\syswow64\ole32.dll, address range [0x75530000-0x7568bfff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugmfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_9b54853441e399d5\mfc90d.dll, address range [0x5deb0000-0x5e0f5fff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_ebfb56996c72aefc\COMCTL32.dll, address range [0x74c20000-0x74ca3fff]
Loaded module: C:\Windows\system32\IMM32.DLL, address range [0x76f50000-0x76faffff]
Loaded module: C:\Windows\syswow64\MSCTF.dll, address range [0x75d60000-0x75e2bfff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.vc90.mfcloc_1fc8b3b9a1e18e3b_9.0.30729.6161_none_49768ef57548175e\MFC90ENU.DLL, address range [0x70f50000-0x70f5cfff]
Loaded module: C:\Windows\syswow64\SHELL32.dll, address range [0x75e50000-0x76a98fff]
Loaded module: C:\Windows\system32\uxtheme.dll, address range [0x70f80000-0x70ffffff]
Loaded module: C:\Users\saalfeld\AppData\Local\FLVService\lib\FLVSrvLib.dll, address range [0x10000000-0x10008fff]
Loaded module: C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll, address range [0x75220000-0x752c2fff]
Loaded module: C:\Windows\system32\dwmapi.dll, address range [0x70f60000-0x70f72fff]
Loaded module: C:\Windows\system32\ole32.dll, address range [0x0a440000-0x0a59bfff]
Unloaded module: C:\Windows\system32\ole32.dll
Process c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\inspect_test.exe exited with code 0. Leak analysis starting. Please wait...
Unloaded module: c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\inspect_test.exe
Unloaded module: C:\Windows\system32\apphelp.dll
Unloaded module: C:\Windows\system32\VERSION.dll
Unloaded module: C:\Windows\syswow64\KERNELBASE.dll
Unloaded module: C:\Windows\syswow64\kernel32.dll
Unloaded module: C:\Windows\syswow64\msvcrt.dll
Unloaded module: C:\Windows\SysWOW64\ntdll.dll
Unloaded module: c:\Users\saalfeld\Documents\Visual Studio 2008\Projects\zipper\Debug\dll.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugmfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_9b54853441e399d5\mfc90ud.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\MSVCR90D.dll
Unloaded module: C:\Windows\syswow64\USER32.dll
Unloaded module: C:\Windows\syswow64\GDI32.dll
Unloaded module: C:\Windows\syswow64\LPK.dll
Unloaded module: C:\Windows\syswow64\USP10.dll
Unloaded module: C:\Windows\syswow64\ADVAPI32.dll
Unloaded module: C:\Windows\SysWOW64\sechost.dll
Unloaded module: C:\Windows\syswow64\RPCRT4.dll
Unloaded module: C:\Windows\syswow64\SspiCli.dll
Unloaded module: C:\Windows\syswow64\CRYPTBASE.dll
Unloaded module: C:\Windows\syswow64\SHLWAPI.dll
Unloaded module: C:\Windows\system32\MSIMG32.dll
Unloaded module: C:\Windows\syswow64\OLEAUT32.dll
Unloaded module: C:\Windows\syswow64\ole32.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.vc90.debugmfc_1fc8b3b9a1e18e3b_9.0.21022.8_none_9b54853441e399d5\mfc90d.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16661_none_ebfb56996c72aefc\COMCTL32.dll
Unloaded module: C:\Windows\system32\IMM32.DLL
Unloaded module: C:\Windows\syswow64\MSCTF.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.vc90.mfcloc_1fc8b3b9a1e18e3b_9.0.30729.6161_none_49768ef57548175e\MFC90ENU.DLL
Unloaded module: C:\Windows\syswow64\SHELL32.dll
Unloaded module: C:\Windows\system32\uxtheme.dll
Unloaded module: C:\Users\saalfeld\AppData\Local\FLVService\lib\FLVSrvLib.dll
Unloaded module: C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll
Unloaded module: C:\Windows\system32\dwmapi.dll
Application exit code: [-1073741819]
Result file:
Memory error analysis: completed
Kirill_R_Intel
Employee
136 Views

Good idea to compare the logs. My logs look very similar except one thing: Application exit code is 0 in my results. Yours is -1073741819 that doesn't seem correct. However message in the middle of the trace says your application exited with code 0, and there is mismatch.

For your reference my collectortraces: My collector log
Daniel_Saalfeld
Beginner
136 Views

Noticed odd dll's in mine ... one which was related to some service that was running - flvsrvc.exe or something like that. So I did a selective startup and disabled most services and startup apps. I can now get a 0 exit code for the test app and it reports all the issues. However my real project still doesn't report all the issues and has that odd exit code.

So it seems like it is definitely something to do with my machine and other installed/running software. Going to do a full virus scan and see what else I can disable in startup and see if I can't get to a 0 exit code for my real project. Hopefully can get a handle on what specifically is causing the issue and let you know.

Thanks again for the help.
Daniel_Saalfeld
Beginner
136 Views

I wonder ... since it looks like the executable itself is exiting with a 0 ... is that odd exit code coming from the unloading of the other dlls? Maybe the collector messages could be changed to show the exit/unloading result for each dll rather than just the final one to make debugging these types of issues easier?
Daniel_Saalfeld
Beginner
136 Views

Well I still haven't had any luck getting my real project to be analyzed correctly. I think I know how you can reproduce the issue though with the project I provided. If you install freecorder4http://www.applian.com/freecorder4/ and then do the test2 again you should get that odd exit code and not see the gdi leaks or memory leaks in the dll.
Uninstalling freecorder4 will make the test app analyze correctly again. Though this doesn't fix my real project, I'm guessing it's a similar issue (something in the dll unloading sequence possibly?). Hopefully though this will give you something to work with.
edit: another thing to note ... comparing the collector messages for when freecorder4 is installed vs when it isn't... freecorder4 loads the non-debug vc90.crt dll. Maybe loading both the debug and non-debug crt causes problems?
Kirill_R_Intel
Employee
136 Views

Yes, I'm able to reproduce the issue with the freecoder. The collector messages can't be extended to show what dll breaks the application. This is not what Inspector XE does, this is internal application logic.

Loading both debug and release dlls can cause the problem - e.g. there are can be same symbols in both dlls and some mess up which one to call. I'm not sure about certain way how to find the problem dll on your real app. You may try to remove directories from %PATH% - but not default system ones. Maybe absence of some path can cut off the problem dll and give you a promtp. Try to find other dlls that are loaded in debug and release versions both.
Daniel_Saalfeld
Beginner
136 Views

So is this issue something that is going to be looked into further and hopefully fixed in Inspector now that you can reproduce it?
Because the main issue isn't that Inspector can't find the leaks -- it can, it just doesn't find them when access error checking is also enabled.
One other thing I'm not sure I really understand ... why does the access error analysis have to go through the dll unload stuff that apparently a leaks only analysis doesn't? (or at least it doesn't emit any collector messages)
Reply