caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] memory mapped files with bigarray on windows
@ 2014-09-18  8:04 Bauer, Christoph
  2014-09-18  8:24 ` Gabriel Scherer
  2014-09-18 11:09 ` Gerd Stolpmann
  0 siblings, 2 replies; 4+ messages in thread
From: Bauer, Christoph @ 2014-09-18  8:04 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]

Dear All,

my program maps  several blocks of a file into memory with Bigarray.Array1.map_file for writing.
Finally the file handle is closed with Unix.close.

On local files system everything works as expected. But if the file is on a network drive,
the resulting file is after the close still  locked [1] and it contains just zeros.

My workaround is, to call  Gc.full_major() before the close. Then all remaining bigarrays are
finalized (the finalizer calls caml_ba_unmap_file(), see bigarray_stubs.c).

Calling Gc.full_major () is somewhat dissatisfying. But I’m not sure how it could be solved more cleanly.
I would expect that Unix.close should unmap all remaining views of the file. But Unix.close knows nothing
about the bigarray mapping.

Maybe a special Bigarray.unmap is the solution.

Does anyone has a better idea?

Thanks,
Christoph Bauer

[1] You can’t delete it in the windows explorer.



-----------------
Siemens Industry Software GmbH & Co. KG; Anschrift: Franz-Geuer-Str. 10, 50823 Köln;
Kommanditgesellschaft: Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRA 28227;
Geschäftsführung und persönlich haftender Gesellschafter: Siemens Industry Software Management GmbH;
Geschäftsführer: Urban August, Daniel Trebes; Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRB 70858

[-- Attachment #2: Type: text/html, Size: 3499 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-18 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18  8:04 [Caml-list] memory mapped files with bigarray on windows Bauer, Christoph
2014-09-18  8:24 ` Gabriel Scherer
2014-09-18 11:09 ` Gerd Stolpmann
2014-09-18 14:41   ` AW: " Bauer, Christoph

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).