[Numpy-discussion] memmap close() and flush()
Travis Oliphant
oliphant at ee.byu.edu
Wed Jan 31 11:47:40 CST 2007
Fernando Perez wrote:
>On 1/31/07, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
>
>>Sebastian Haase wrote:
>>
>>
>>>Hi!
>>>Do numpy memmap have a way of explicitly
>>>flushing data to disk
>>>and/or
>>>closing the memmap.
>>>
>>>
>>>
>>There is a sync method that performs the flush. To close the memmap,
>>delete it.
>>
>>More detail:
>> The memmap sub-class has a _mmap attribute that is the Python
>>memory-map object.
>>
>>
>
>Quick question out of ignorance: shouldn't the API offer an explicit
>close method? The reason is that in python, doing 'del foo' doesn't
>ensure real deletion of the underlying object that will fire the
>close methods, since you may easily have other names pointing to the
>same object. Having an explicit, guaranteed way to call .close()
>sounds like a good thing to me, but I may well be missing something.
>
>
>
I don't know. If you have other things pointing to it, should you
really close it?
At any rate you have access to the mmap file through the _mmap
attribute. So, you can always do
self._mmap.close()
-Travis
More information about the Numpy-discussion
mailing list