3 ms·
That's right; my point was that the time to zero memory was considered significant overhead regardless of where it occurred. > I think that your concern is val
by gumby 10y ago
That's right; my point was that the time to zero memory was considered significant overhead regardless of where it occurred.
> I think that your concern is valid, something that a lot of people aren't aware of, but it probably doesn't really apply in a lot of cases most people deal with. Unless your dealing with entities that take up a page or more, then chances are the rest of the page is being used by something else.
vardump's objection addresses VM pressure, to which you respond. But zeroing objects on allocation is likely to have negative implications on the cache, slightly mitigated only in the case where you immediately initialize nonzero values. RAII can in theory alleviate some of that but I am unaware of any compiler that does this.
> All that said, if such a thing [large objects] is actually a worry then you should probably skip the default allocator move to an interface like `mmap()` anyway, which can provide pages of memory that you can be sure are untouched and read as zeros.
... zeroed by the mechanism of this patch!