Created
October 12, 2015 01:18
-
-
Save anonymous/574f6a477edd25a60e19 to your computer and use it in GitHub Desktop.
SO32635860 - Output of sample code (http://stackoverflow.com/q/32635860/2573395)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Included in this gist are the two outputs for running the sample code (unmodified except for | |
timestamp zero padding) that accompanies the StacKOverflow question "How to prevent flushing | |
to disk of a memory map opened on a windows temporary delete-on-close file" | |
(http://stackoverflow.com/q/32635860/2573395). | |
TempFileMapping(false).txt | |
------------------------- | |
Contains the output of running the method with an argument value of 'false'. I.e. closing | |
the view before the file handle. | |
As you can see there is a "blocking delay" (of around 4 seconds) between "handle closing" | |
and "handle closed", which captures the time it takes for the call to `CloseHandle` on a | |
chunk file handle to return, for 3 out of the 4 chunks (1, 2, and 0). Only for the last | |
handle being closed just before the process exits (chunk 3), this delay is not seen. | |
Also worth noting is that the delay occurs on the **first** call to close the file handle, | |
see lines 8, 12 and 39 of the gist. | |
The accompanying 'TempFileMapping(false).jpg' screen cap (http://i.stack.imgur.com/6gFGD.jpg) | |
shows that all 4 of the created chunk files are being 'bulk flushed' to disk when they are | |
closed. | |
TempFileMapping(true).txt | |
------------------------- | |
Contains the output of running the method with an argument value of 'true'. I.e. closing | |
the file handle before the view. | |
As you can see there is a "blocking delay" (of around 4 seconds) between "handle closing" | |
and "handle closed", which captures the time it takes for the call to `CloseHandle` on a | |
chunk file handle to return, for 2 out of the 4 chunks (1, 2). These are the two chunks | |
that were being "released" in the sample code. | |
Also worth noting is that the delay occurs on the **last** call to close the file handle, | |
see lines 21 and 26 of the gist. | |
The accompanying 'TempFileMapping(true).jpg' screen cap (http://i.stack.imgur.com/iCQ9J.png) | |
shows that only 2 of the created chunk files are being 'bulk flushed' to disk when they are | |
closed, namely the chunks 1 and 2 that were "released" from 'arena 1' while 'arena 2' still | |
held an open handle on these files. | |
Other remarks: | |
-------------- | |
Note that sufficient memory is available as shown though the 'TempFileMapping.Mem.jpg' screen | |
capture (http://i.stack.imgur.com/aqpDn.jpg). | |
This shows 3 GB of free memory being available before running, suggesting there should be no | |
need to flush any pages due to memory pressure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[00000] Mapping with 2 arenas and unmapping views before closing file handles. | |
[00000] allocating 100000 pages through arena 1. | |
[00312] 4 chunks created. | |
[00327] arena 2 loaded, going to release chunks 1 and 2 from arena 1 | |
[00327] data/page_pool.1.chunk view closing | |
[00343] data/page_pool.1.chunk view closed | |
[00343] data/page_pool.1.chunk file handle closing | |
[04430] data/page_pool.1.chunk file handle closed | |
[04430] chunk 1 released from arena 1 | |
[04430] data/page_pool.2.chunk view closing | |
[04477] data/page_pool.2.chunk view closed | |
[04477] data/page_pool.2.chunk file handle closing | |
[08595] data/page_pool.2.chunk file handle closed | |
[08595] chunk 2 released from arena 1 | |
[08611] data/page_pool.0.chunk view closing | |
[08611] data/page_pool.0.chunk view closed | |
[08611] data/page_pool.0.chunk file handle closing | |
[08626] data/page_pool.0.chunk file handle closed | |
[08626] chunk 0 released from arena 2 | |
[08642] data/page_pool.1.chunk view closing | |
[08642] data/page_pool.1.chunk view closed | |
[08642] data/page_pool.1.chunk file handle closing | |
[08689] data/page_pool.1.chunk file handle closed | |
[08689] chunk 1 released from arena 2 | |
[08689] data/page_pool.2.chunk view closing | |
[08689] data/page_pool.2.chunk view closed | |
[08689] data/page_pool.2.chunk file handle closing | |
[08720] data/page_pool.2.chunk file handle closed | |
[08736] chunk 2 released from arena 2 | |
[08736] data/page_pool.3.chunk view closing | |
[08736] data/page_pool.3.chunk view closed | |
[08736] data/page_pool.3.chunk file handle closing | |
[08736] data/page_pool.3.chunk file handle closed | |
[08736] chunk 3 released from arena 2 | |
[08751] arena 2 destructed | |
[08751] data/page_pool.0.chunk view closing | |
[08767] data/page_pool.0.chunk view closed | |
[08767] data/page_pool.0.chunk file handle closing | |
[12761] data/page_pool.0.chunk file handle closed | |
[12761] chunk 0 released from arena 1 | |
[12761] data/page_pool.3.chunk view closing | |
[12761] data/page_pool.3.chunk view closed | |
[12776] data/page_pool.3.chunk file handle closing | |
[12932] data/page_pool.3.chunk file handle closed | |
[12948] chunk 3 released from arena 1 | |
[12948] arena 1 destructed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[00000] Mapping with 2 arenas and closing file handles before unmapping views. | |
[00000] allocating 100000 pages through arena 1. | |
[00312] 4 chunks created. | |
[00328] arena 2 loaded, going to release chunks 1 and 2 from arena 1 | |
[00328] data/page_pool.1.chunk file handle closing | |
[00343] data/page_pool.1.chunk file handle closed | |
[00343] data/page_pool.1.chunk view closing | |
[00359] data/page_pool.1.chunk view closed | |
[00359] chunk 1 released from arena 1 | |
[00359] data/page_pool.2.chunk file handle closing | |
[00375] data/page_pool.2.chunk file handle closed | |
[00375] data/page_pool.2.chunk view closing | |
[00390] data/page_pool.2.chunk view closed | |
[00406] chunk 2 released from arena 1 | |
[00406] data/page_pool.0.chunk file handle closing | |
[00406] data/page_pool.0.chunk file handle closed | |
[00421] data/page_pool.0.chunk view closing | |
[00421] data/page_pool.0.chunk view closed | |
[00421] chunk 0 released from arena 2 | |
[00421] data/page_pool.1.chunk file handle closing | |
[04493] data/page_pool.1.chunk file handle closed | |
[04493] data/page_pool.1.chunk view closing | |
[04509] data/page_pool.1.chunk view closed | |
[04524] chunk 1 released from arena 2 | |
[04524] data/page_pool.2.chunk file handle closing | |
[09891] data/page_pool.2.chunk file handle closed | |
[09906] data/page_pool.2.chunk view closing | |
[09906] data/page_pool.2.chunk view closed | |
[09922] chunk 2 released from arena 2 | |
[09937] data/page_pool.3.chunk file handle closing | |
[09937] data/page_pool.3.chunk file handle closed | |
[09937] data/page_pool.3.chunk view closing | |
[09953] data/page_pool.3.chunk view closed | |
[09953] chunk 3 released from arena 2 | |
[09953] arena 2 destructed | |
[09953] data/page_pool.0.chunk file handle closing | |
[09969] data/page_pool.0.chunk file handle closed | |
[09969] data/page_pool.0.chunk view closing | |
[10000] data/page_pool.0.chunk view closed | |
[10000] chunk 0 released from arena 1 | |
[10000] data/page_pool.3.chunk file handle closing | |
[10015] data/page_pool.3.chunk file handle closed | |
[10015] data/page_pool.3.chunk view closing | |
[10015] data/page_pool.3.chunk view closed | |
[10015] chunk 3 released from arena 1 | |
[10015] arena 1 destructed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment