Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement allocateZeroed for building-block allocators #6692

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

n8sh
Copy link
Member

@n8sh n8sh commented Sep 4, 2018

Followup to #6411

Some allocators can allocate zeroed memory more efficiently than allocate + memset.
[...]
This PR adds non-public allocateZeroed methods to Mallocator and MmapAllocator and GCAllocator. Various derived allocators could also implement such methods when their parent allocators support them, but that work is left to a future PR

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @n8sh!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#6692"

@n8sh n8sh force-pushed the allocate-zeroed-pt2 branch 6 times, most recently from 3238f99 to ad66934 Compare September 8, 2018 12:27
@n8sh n8sh force-pushed the allocate-zeroed-pt2 branch from ad66934 to a3dfcc1 Compare September 8, 2018 14:56
Copy link
Member

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this and we should really start to expose allocateZeroed publicly. Maybe do so in a separate new PR?

return result;
}
return null;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of duplication with allocate as essentially only the called subfunction differs.
Maybe generate the string for both and mix it in?

@dlang-bot dlang-bot merged commit 0032c8d into dlang:master Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants