ocaml / flexdll

a dlopen-like API for Windows
Other
97 stars 30 forks source link

Temporary files not deleted on exit #102

Closed xavierleroy closed 1 year ago

xavierleroy commented 1 year ago

After a full build of OCaml 5 with the MinGW toolchain, I see about 30 dyndllXXXXXX.o files left over in /tmp.

I suspect these files were created by flexlink.

On CI machines, after a few hundred builds, /tmp becomes so cluttered as to slow down builds noticeably and cause problems with ssh logins.

dra27 commented 1 year ago

It turns out it's been doing this for a while! If flexlink is passed a C file on the command line (e.g. the primitives file in -custom mode) then it compiles a temporary object which is marked for deletion on exit. The problem is that flexlink doesn't close objects/libraries which it's read symbols from because it used to have infrastructure where sections were read lazily.

dra27 commented 1 year ago

I'm fairly sure that switching winpthreads to static in 5.0 is going to require a tweak in flexlink - I'm expecting to get to that when I get back from holiday in a few weeks. Would it be OK for a release of flexlink to wait until that's cleared up? I'm guessing in the meantime that clearing out the tmp directory on the Windows workers has bought a little more time?

xavierleroy commented 1 year ago

Thanks for the quick fix! Yes, the release can wait for several months. I estimate it takes about one year for our CI Windows machine to slow down noticeably because of the overfull /tmp directory.