Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f74c462b804f2d95e1dc4f9a4602af7db2eeaea7
Ticket: 545579ffffffffffffffffffffffffffffffffff
cleanup after load from VFS
User & Date: jcw on 2002-04-18 10:15:38
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    In tclIOUtil.c, there is extensive logic to load 
    shared libs from VFS - even creating a temp copy (see 
    Tcl_FSLoadFile).  Loading appears to work fine - the 
    TclVFS extension does not override load, and things 
    are ok with TclKit and Scripted Documents.
    
    But unloading does not clean up such a temp file.  
    After long term use, lots of "tclXXXXX" files can 
    accumulate in /tmp (on Linux).
    
    This can only be tested from a VFS-mounted FS, 
    because normal loading surely loads as is, no copy 
    made at all.  An example is to run tclkit with one of 
    the scripted docs that contain a binary loaded 
    extension - such as in http://www.equi4.com/pub/dok/.
    
    Desired behavior: temp copy is deleted after use.
    
    In fact, on Unix systems, one can probably delete 
    right after loading - the temp copy does not need to 
    exist when the shared library is in use.  This has as 
    major benefit that aborts/crashes do not leave 
    dangling files.
    
    On Windows, the file cannot be deleted while in use.  
    The least would be to delete on exit (as the unload 
    logic in tclIOUtil.c appears to be intended).  If 
    cleanup even with aborts are desired, then the 
    Windows version may need to do special calls to 
    register the files for cleanup on restart of Windows 
    (not sure what the API is, or where, but it exists).
    
    Windows may be harder - also because I'm not sure a 
    DLL should be unloaded by Tcl (the usual reasons come 
    to mind: C++ cleanup handling may not have occurred, 
    and an atexit call into the lib may be pending).  If 
    all else fails, then perhaps the only way out is to 
    reuse a fixed set of file names for creating the temp 
    copies ouf of VFS (tcl001.dll. tcl002.dll, etc) - so 
    that at least names are re-used (and long term use do 
    not lead to an unbounded number of copies).  Or Tcl 
    could clean up its set of names on startup - multiple 
    invocations are no problem, if the dll is still is 
    use then the delete fails and can be ignored.
    
    I'll be happy to help test the different scenario's, 
    but I don't oversee all issues and the core code well 
    enough to be able to code the solutions.  Besides, 
    maybe it's almost there, just a few tweaks away from 
    working just fine on Unix and Windows.
    
    
  4. foundin changed to: "obsolete: 8.4a5"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "jcw"
  9. subsystem changed to: "37. File System"
  10. title changed to: "cleanup after load from VFS"
  11. type changed to: "Bug"