Bug 1360772 - Indicate to chunk_recycle callers that pages_commit has zeroed the chunk. r=njn

Before returning a chunk, chunk_recycle calls pages_commit (when
MALLOC_DECOMMIT is enabled), which is guaranteed to zero the chunk.

The code further zeroing the chunk afterwards, which is now moved out to
chunk_alloc callers, never took advantage of that fact, duplicating the
effort of zeroing the chunk on Windows.

By indicating to the callers that the chunk has already been zeroed, we
allow callers to skip zeroing on their own.
This commit is contained in:
Mike Hommey 2017-07-06 16:58:18 +09:00
parent 78a584db8a
commit e6c1516607

View File

@ -2060,6 +2060,10 @@ chunk_recycle(extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, size_t size,
base_node_dealloc(node);
#ifdef MALLOC_DECOMMIT
pages_commit(ret, size);
// pages_commit is guaranteed to zero the chunk.
if (zeroed) {
*zeroed = true;
}
#endif
return (ret);
}