c++ - Characteristics of mremap function in Linux -
in linux mremap function used remap memory mapped using mmap. please me clarify following:
- if mremap function failed, status of old mapped memory?
- if mremap function failed, there need of calling function munmap?
- if mremap function succeeded, previous data in remapped memory?
mremap attempts increase allocation in-place, falls allocating new region if cannot increase size of current region.
mremap() expands (or shrinks) existing memory mapping, potentially moving @ same time (controlled flags argument , available virtual address space). src
if mremap fails, old memory fine (just realloc).
if mremap fails, there's nothing munmap (from this call, @ least). see item 1.
if mremap succeeds , has move, old memory copied new (and old 1 munmap'ped you). if mremap able increase size in-place, memory not moved , no new allocation created.
Comments
Post a Comment