[MLton] Writing memory to disk ...
Adam Goode
adam@evdebs.org
Wed, 24 May 2006 17:03:16 -0400
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig59CF35985443AC88F2D908AA
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Wesley W. Terpstra wrote:
> On May 24, 2006, at 10:06 PM, Henry Cejtin wrote:
>> It isn't enough for write_safe to not abort. You really want to do
>> the unlink
>> before the write. The point is that if you don't, then if I kill the
>> ap via
>> control-C while it is doing the slow disk write and read (not
>> unlikely) then
>> the disk file is going to be left around.
>=20
> I already said I agree that this is better on Unix.
> However, you can't delete an open file under windows.
> If it's special-cased to be different, then fine.
>=20
Actually, you can sort of do this. There's a way to mark files so that
they are deleted on close. (I think this is how DeleteFile works in the
normal case on Windows.)
To make a temporary file for this heap-dumping on Windows:
First, you call GetTempPath to get the path for temporary files.
Then call GetTempFileName, passing the result of GetTempPath.
Finally, call CreateFile with the result of GetTempFileName. If you pass
FILE_FLAG_DELETE_ON_CLOSE to CreateFile, the system will clean it up
for you.
I haven't tested this, just read the reference documentation:
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/fileio=
/fs/createfile.asp
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/fileio=
/fs/deletefile.asp
Thanks,
Adam
--------------enig59CF35985443AC88F2D908AA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFEdMoXlenB4PQRJawRAiKKAKCWi9dD+k8xqa5BRXEMPc249GZkSACfcgvd
W6DX+nOrAiVeKns3QRrBHdM=
=z4yV
-----END PGP SIGNATURE-----
--------------enig59CF35985443AC88F2D908AA--