[lldb-dev] target delete doesn't drop file handles

Zachary Turner zturner at google.com
Tue Mar 24 15:53:24 PDT 2015


I've tracked down the source of a bunch of test failures on Windows which
are caused by file handle leaks.  The symptom of the problem is that if you
run "file a.out" the file is locked after that, and you cannot delete it.
This causes a bunch of tests to fail when "make clean" can't delete the
file.

Thas to do with the nature of the Windows kernel and how it treats memory
mapped files.  Essentially what is happening is
that ModuleList::GetSharedModule() is mmapping the file and intentionally
leaking the handle.  So even doing target delete won't free the handle.

I'm guessing this is an optimization, but how necessary is it?  Assuming it
needs to stay, would it be reasonable for me to disable this intentional
leak for Windows behind a preprocessor definition, make target delete
remove the module from the shared module list, and update the test suite to
always free created targets on teardown?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150324/bec10e32/attachment.html>


More information about the lldb-dev mailing list