Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/Kernel    [ Add a report in this area ]  
Report #:  105214   Status: Open
[x64] The debugger keeps a handle open to loaded DLLs
Project:  Delphi Build #:  16.0.4429.46931
Version:    16.4 Submitted By:   Olivier Sannier
Report Type:  Crash / Data loss / Total failure Date Reported:  4/26/2012 6:58:46 AM
Severity:    Commonly encountered problem Last Updated: 4/30/2012 1:31:39 AM
Platform:    All versions Internal Tracking #:   27670
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
[x64]
Programs can load DLL files via LoadLibrary and unload them via FreeLibrary.
When this happens, the x64 debugger (dbkw64_16_0.exe) opens its own handle to the given DLL file and keeps it until the host process is closed.
This is problematic because the DLL might have been generated by the host process, which then wants to delete the generated DLL file when it no longer needs it.
In my case, this happens in a series of unit tests where many generations are done one after the other.
But because the x64 debugger keeps a handle opened on the DLL file, one cannot delete it (the file is still there despite DeleteFile returning true) nor can it overwrite it.

The x64 debugger should close its own handle to the loaded library as soon as the debugged process releases its last reference too.
Steps to Reproduce:
Open the project group in the attachment
Run the DUnit project under XE2
See that the test fails

If you run outside the IDE, the test succeeds.
Workarounds
Use ProcessExplorer to "kill" the handle that dbkw64_16_0.exe is holding
Attachment
105214.zip
Comments

Tomohiro Takahashi at 4/26/2012 7:42:37 AM -
I deleted QC#105212, 105213 as Sysop. Please do not post same reports.

Tomohiro Takahashi at 5/2/2012 7:30:42 PM -
This report was opened with valid Internal Tracking Number.
Thanks.

Server Response from: ETNACODE01