[fpc-devel] Dr Memory Interpretation
mark diener
rpzrpzrpz at gmail.com
Mon Aug 11 15:38:05 CEST 2014
Jonas Maebe suggested that I try Dr Memory to track down a possible heap
corruption in one of my test programs.
This has led to what I think deserves it own discussion thread.
I ran a lazarus 1.2.4/fpc 2.6.4 compiled programs on Windows 8.1 x64
compilied with Dwarf2 (-dw2)
and HeapTrc On, Range Check ON (-Cr), Verify Method On (-CR)
The minimal example is just creating a simple lazarus application with a
single unpopulated form. Compile. Run.
Attached is the results file and the sample minimal app for verification.
Command line for Dr Memory: C:\pdev\rpztestminimum>drmemory.exe --
rpztestminimum.exe <enter>
Heaptrc when turned on with CMEM commented out reports no heap errors.
What I find suprising is the number of ERRORS that Dr Memory discovered on
a raw, naked, simple lazarus application.
Anybody have greater experience with Dr Memory to know what errors are
actually real and which errors are valid in the latests releases of
lazarus/fpc.
Cheers,
marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140811/c7265352/attachment.html>
-------------- next part --------------
Dr. Memory version 1.7.0 build 5 built on Apr 4 2014 23:38:05
Dr. Memory results for pid 312: "rpztestminimum.exe"
Application cmdline: "rpztestminimum.exe"
Recorded 104 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin\suppress-default.txt
Error #1: UNADDRESSABLE ACCESS: reading 0x04c491c3-0x04c491c4 1 byte(s) within 0x04c491c0-0x04c491c4
# 0 FPC_PCHAR_TO_SHORTSTR [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 1 SYSTEM_STRPAS$PCHAR$$SHORTSTRING [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 2 HEAPTRC_GETENV$SHORTSTRING$$SHORTSTRING [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 3 HEAPTRC_LOADENVIRONMENT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 INIT$_HEAPTRC [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 fpc_initializeunits [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 6 DEBUGSTART_P$RPZTESTMINIMUM [C:/pdev/rpztestminimum//rpztestminimum.lpr:16]
# 7 SYSTEM_EXE_ENTRY$TENTRYINFORMATION [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 8 WinMainCRTStartup [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 9 KERNEL32.dll!BaseThreadInitThunk +0xd (0x7570919f <KERNEL32.dll+0x1919f>)
Note: @0:00:00.453 in thread 3820
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc: 0x04c48a30-0x04c491c3
Note: instruction: mov (%esi) -> %ebx
Error #2: UNADDRESSABLE ACCESS: reading 0x0508cf61-0x0508cf64 3 byte(s) within 0x0508cf60-0x0508cf64
# 0 SYSTEM_SMALLFORWARDMOVE_3 [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 1 FPREADPNG_TFPREADERPNG_$__INTERNALCHECK$TSTREAM$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 2 FPREADPNG_TFPREADERPNG_$__INTERNALCHECK$TSTREAM$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 3 FPIMAGE_TFPCUSTOMIMAGEREADER_$__CHECKCONTENTS$TSTREAM$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 FPIMAGE_TFPCUSTOMIMAGEREADER_$__IMAGEREAD$TSTREAM$TFPCUSTOMIMAGE$$TFPCUSTOMIMAGE [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 GRAPHICS_TCUSTOMICON_$__READSTREAM$TMEMORYSTREAM$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 6 GRAPHICS_TRASTERIMAGE_$__LOADFROMSTREAM$TSTREAM$LONGWORD [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 7 GRAPHICS_TRASTERIMAGE_$__LOADFROMSTREAM$TSTREAM [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 8 GRAPHICS_TCUSTOMICON_$__READDATA$TSTREAM [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 9 GRAPHICS_TICON_$__LOADFROMRESOURCEHANDLE$LONGWORD$LONGWORD [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#10 FORMS_TAPPLICATION_$__INITIALIZE [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 DEBUGSTART_P$RPZTESTMINIMUM [C:/pdev/rpztestminimum//rpztestminimum.lpr:18]
Note: @0:00:01.844 in thread 3820
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc: 0x0508cf50-0x0508cf61
Note: instruction: mov 0xfffffffc(%eax) -> %ecx
Error #3: UNADDRESSABLE ACCESS: reading 0x050ee701-0x050ee704 3 byte(s) within 0x050ee700-0x050ee704
# 0 SYSUTILS_STRSCAN$PCHAR$CHAR$$PCHAR [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 1 CLASSES_TREADER_$__READPROPERTY$TPERSISTENT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 2 CLASSES_TREADER_$__READDATA$TCOMPONENT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 3 CLASSES_TCOMPONENT_$__READSTATE$TREADER [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 CONTROLS_TCONTROL_$__READSTATE$TREADER [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 CLASSES_TREADER_$__READROOTCOMPONENT$TCOMPONENT$$TCOMPONENT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 6 LRESOURCES_INITLAZRESOURCECOMPONENT$TCOMPONENT$TCLASS$$BOOLEAN_INITCOMPONENT$TCLASS$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 7 LRESOURCES_INITLAZRESOURCECOMPONENT$TCOMPONENT$TCLASS$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 8 LRESOURCES_INITRESOURCECOMPONENT$TCOMPONENT$TCLASS$$BOOLEAN [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 9 FORMS_TCUSTOMFORM_$__CREATE$TCOMPONENT$$TCUSTOMFORM [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#10 FORMS_TFORM_$__CREATE$TCOMPONENT$$TFORM [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 FORMS_TAPPLICATION_$__CREATEFORM$TCOMPONENTCLASS$formal [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
Note: @0:00:02.500 in thread 3820
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc: 0x050ee6f0-0x050ee701
Note: instruction: mov (%edi) -> %edx
Error #4: UNADDRESSABLE ACCESS: writing 0x00000020-0x00000024 4 byte(s) within 0x00000020-0x04c5c950
# 0 system call NtUserBuildPropList parameter #1
# 1 USER32.dll!Ordinal2527 +0x8c (0x754008c9 <USER32.dll+0x508c9>)
# 2 USER32.dll!EnumPropsA +0x13 (0x75400799 <USER32.dll+0x50799>)
# 3 WIN32INT_WINDOWPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 WIN32WSFORMS_CUSTOMFORMWNDPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 USER32.dll!CallNextHookEx +0x96 (0x753b7834 <USER32.dll+0x7834>)
# 6 USER32.dll!GetWindowThreadProcessId +0x3e4 (0x753b930f <USER32.dll+0x930f>)
# 7 USER32.dll!CallNextHookEx +0x44f (0x753b7bed <USER32.dll+0x7bed>)
# 8 USER32.dll!DestroyWindow +0x40 (0x753bad95 <USER32.dll+0xad95>)
# 9 ntdll.dll!KiUserCallbackDispatcher +0x2d (0x773cf342 <ntdll.dll+0x3f342>)
#10 CONTROLS_TWINCONTROL_$__DESTROYWND [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 CONTROLS_TCUSTOMCONTROL_$__DESTROYWND [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
Note: @0:00:06.386 in thread 3820
Error #5: UNADDRESSABLE ACCESS: writing 0x00000020-0x00000024 4 byte(s) within 0x00000020-0x04c5c950
# 0 system call NtUserBuildPropList parameter #1
# 1 USER32.dll!Ordinal2527 +0x8c (0x754008c9 <USER32.dll+0x508c9>)
# 2 USER32.dll!EnumPropsA +0x13 (0x75400799 <USER32.dll+0x50799>)
# 3 WIN32INT_WINDOWPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 WIN32WSFORMS_CUSTOMFORMWNDPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 USER32.dll!CallNextHookEx +0x96 (0x753b7834 <USER32.dll+0x7834>)
# 6 USER32.dll!GetWindowThreadProcessId +0x3e4 (0x753b930f <USER32.dll+0x930f>)
# 7 USER32.dll!CallNextHookEx +0x44f (0x753b7bed <USER32.dll+0x7bed>)
# 8 USER32.dll!DestroyWindow +0x40 (0x753bad95 <USER32.dll+0xad95>)
# 9 ntdll.dll!KiUserCallbackDispatcher +0x2d (0x773cf342 <ntdll.dll+0x3f342>)
#10 CONTROLS_TWINCONTROL_$__DESTROYWND [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 CONTROLS_TCUSTOMCONTROL_$__DESTROYWND [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
Note: @0:00:06.386 in thread 3820
Error #6: UNADDRESSABLE ACCESS: writing 0x00000020-0x00000024 4 byte(s) within 0x00000020-0x04c5ceb0
# 0 system call NtUserBuildPropList parameter #1
# 1 USER32.dll!Ordinal2527 +0x8c (0x754008c9 <USER32.dll+0x508c9>)
# 2 USER32.dll!EnumPropsA +0x13 (0x75400799 <USER32.dll+0x50799>)
# 3 WIN32INT_WINDOWPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 USER32.dll!CallNextHookEx +0x96 (0x753b7834 <USER32.dll+0x7834>)
# 5 USER32.dll!GetWindowThreadProcessId +0x3e4 (0x753b930f <USER32.dll+0x930f>)
# 6 USER32.dll!CallNextHookEx +0x44f (0x753b7bed <USER32.dll+0x7bed>)
# 7 USER32.dll!DestroyWindow +0x40 (0x753bad95 <USER32.dll+0xad95>)
# 8 ntdll.dll!KiUserCallbackDispatcher +0x2d (0x773cf342 <ntdll.dll+0x3f342>)
# 9 SYSTEM_TOBJECT_$__FREE [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#10 FORMS_FREEWIDGETSET [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 FINALIZE$_INTERFACES [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
Note: @0:00:06.590 in thread 3820
Error #7: UNADDRESSABLE ACCESS: writing 0x00000020-0x00000024 4 byte(s) within 0x00000020-0x04c5ceb0
# 0 system call NtUserBuildPropList parameter #1
# 1 USER32.dll!Ordinal2527 +0x8c (0x754008c9 <USER32.dll+0x508c9>)
# 2 USER32.dll!EnumPropsA +0x13 (0x75400799 <USER32.dll+0x50799>)
# 3 WIN32INT_WINDOWPROC$LONGWORD$LONGWORD$LONGINT$LONGINT$$LONGINT [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 4 USER32.dll!CallNextHookEx +0x96 (0x753b7834 <USER32.dll+0x7834>)
# 5 USER32.dll!GetWindowThreadProcessId +0x3e4 (0x753b930f <USER32.dll+0x930f>)
# 6 USER32.dll!CallNextHookEx +0x44f (0x753b7bed <USER32.dll+0x7bed>)
# 7 USER32.dll!DestroyWindow +0x40 (0x753bad95 <USER32.dll+0xad95>)
# 8 ntdll.dll!KiUserCallbackDispatcher +0x2d (0x773cf342 <ntdll.dll+0x3f342>)
# 9 SYSTEM_TOBJECT_$__FREE [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#10 FORMS_FREEWIDGETSET [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 FINALIZE$_INTERFACES [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
Note: @0:00:06.590 in thread 3820
Error #8: POSSIBLE LEAK 64 direct bytes 0x04c489d0-0x04c48a10 + 0 indirect bytes
# 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3076]
# 1 combase.dll!CoTaskMemAlloc +0x3dd (0x74f43e3e <combase.dll+0x3e3e>)
# 2 OLEAUT32.dll!SysFreeString +0x181 (0x76ed3f5e <OLEAUT32.dll+0x3f5e>)
# 3 OLEAUT32.dll!SysReAllocStringLen +0x7f (0x76ed8ba9 <OLEAUT32.dll+0x8ba9>)
# 4 fpc_widestr_assign [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 5 SYSTEM_INITWIN32WIDESTRINGS [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 6 SYSTEM_init [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 7 fpc_initializeunits [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
# 8 DEBUGSTART_P$RPZTESTMINIMUM [C:/pdev/rpztestminimum//rpztestminimum.lpr:16]
# 9 SYSTEM_EXE_ENTRY$TENTRYINFORMATION [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#10 WinMainCRTStartup [C:/pdev/rpztestminimum//rpztestminimum.lpr:21]
#11 KERNEL32.dll!BaseThreadInitThunk +0xd (0x7570919f <KERNEL32.dll+0x1919f>)
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
Error # 3: 4
SUPPRESSIONS USED:
ERRORS FOUND:
7 unique, 10 total unaddressable access(es)
0 unique, 0 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
0 unique, 0 total, 0 byte(s) of leak(s)
1 unique, 1 total, 64 byte(s) of possible leak(s)
ERRORS IGNORED:
59 potential error(s) (suspected false positives)
(details: C:\Users\md\AppData\Roaming\Dr. Memory\DrMemory-rpztestminimum.exe.312.000\potential_errors.txt)
89 potential leak(s) (suspected false positives)
(details: C:\Users\md\AppData\Roaming\Dr. Memory\DrMemory-rpztestminimum.exe.312.000\potential_errors.txt)
4 unique, 4 total, 127 byte(s) of still-reachable allocation(s)
(re-run with "-show_reachable" for details)
Details: C:\Users\md\AppData\Roaming\Dr. Memory\DrMemory-rpztestminimum.exe.312.000\results.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpztestminimum.zip
Type: application/zip
Size: 128707 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140811/c7265352/attachment.zip>
More information about the fpc-devel
mailing list