Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 12cb22616a7d6a80b96128bf9a537a36953469e44d27b0e06327884c96ebc4e7
Ticket: a8e4f76ce498ad648134e0b6867c359949055388
load library (dll) from zipfs-library causes a leak in temporary folder
User & Date: chw on 2024-11-27 07:40:58
Changes

  1. icomment:
    OK, Ashok. Let me clarify (and let us leave Wine and build-time out for now).
    
    * When does memory loading occur?
    
    A shared object shall be Tcl_LoadFile()'d and is not in the native filesystem.
    Otherwise the normal platform specific loader is used.
    
    * Why is memory loading attractive?
    
    Because it requires nearly only RAM, not much else. RAM is cheap nowadays.
    And there is plenty, usually.
    
    * Which platforms provide memory loading OOTB?
    
    MacOS.
    
    * Which platforms allow for safe implementation of the MacOS functionality?
    
    POSIX when supporting dlopen(), shm_open(), and mmap(), or Linux >= 3.17
    with dlopen() and memfd_create(). In both cases the shared object is
    copied into a named shared memory which then is dlopen()'ed. On FreeBSD
    there's fdlopen() which allows to use the open shared memory instead of
    the name of the shared memory, even.
    
    * Which platforms allow for immediate deletion of a file in native
      filesystem after it has been dlopen()'d?
    
    POSIX. Windows most likely only in very specific contexts, i.e. normally not.
    That seems to be the main reason to have a temporary directory for DLL's
    loaded on Windows.
    
    * Why do I prefer MemoryModule on Windows?
    
    See above, for symmetry. And RAM is cheap on Windows, too.
    
    * What are alternatives?
    
    If it would be possible to have a comparable trickery using named shared
    memories plus LoadLibrary() on them on Windows, that would be even better.
    
    
    Further comments:
    
    I see your point: people which create a huge multi gigabyte C++ AI DLL
    blob which they want to deliver as part of a ZIPFS bundled tclsh or
    wish app. For now they have already to wait for ZIP64 support. OTOH,
    as long as we thoroughly document the limitations of memory loading for
    the Windows platform, they will have to understand that wrapping in this
    case is not supported. And that a persistent install mechanism is the
    better solution in this case anyway, since load time of that blob at
    startup has in any implementation of memory loading a negative impact
    on user experience.
    
  2. login: "chw"
  3. mimetype: "text/x-fossil-plain"