Thanks to visit codestin.com
Credit goes to github.com

Skip to content

calloc forces unecessary page faults #28

@Carlyle-Foster

Description

@Carlyle-Foster

/* We use calloc() so we give a chance for the OS to reserve virtual memory without really using physical memory,

calloc actually does the opposite of this, since it zeroes out the memory it forces page faults on every allocated page. the OS does often guarantee that newly allocated memory will be zeroed, so a calloc implementation could avoid zeroing the memory when it's freshly allocated from the OS and not reused, but that would require not implementing calloc in terms of malloc and i know at least musl does that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions