Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-6740

[Python] Unable to delete closed MemoryMappedFile on Windows

    XMLWordPrintableJSON

Details

    Description

      import os
      import pyarrow as pa
      
      # Create a file and memory-map it
      file_name = 'path-to-a-new-file'
      mmap = pa.create_memory_map(file_name, 100)
      
      # or open an existing file
      # file_name = 'path-to-an-existing-file'
      # mmap = pa.memory_map(file_name)
      
      # close it
      mmap.close()
      mmap.closed  # True
      
      # try to delete it (can't delete until the python interpreter is killed)
      os.remove(file_name)  # PermissionError
      
      # Note: opening an existing file as `pa.input_stream` works as expected

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              mosalx Sergey Mozharov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h