Thread (35 messages) flat view 35 messages, 3 authors, 2016-06-16

Re: [PATCH v5 02/15] read-cache: allow to keep mmap'd memory after reading

From: Johannes Schindelin <hidden>
Date: 2016-06-16 02:18:52

Hi Dave,

On Tue, 19 Apr 2016, David Turner wrote:
quoted hunk ↗ jump to hunk
 unmap:
+	istate->mmap = NULL;
 	munmap(mmap, mmap_size);
 	die("index file corrupt");
 }
[...]
@@ -1698,6 +1705,10 @@ int discard_index(struct index_state *istate)
 	free(istate->cache);
 	istate->cache = NULL;
 	istate->cache_alloc = 0;
+	if (istate->keep_mmap && istate->mmap) {
+		munmap(istate->mmap, istate->mmap_size);
+		istate->mmap = NULL;
+	}
 	discard_split_index(istate);
Just curious: any reason why the first hunk munmap()s after resetting the
field to NULL and the second hunk does it in the opposite order?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help