Is it true, that modern OS may skip copy when realloc is called

后端 未结 2 1493
再見小時候
再見小時候 2020-12-05 16:30

While reading the https://stackoverflow.com/a/3190489/196561 I have a question. What the Qt authors says in the Inside the Qt 4 Containers:

... QVecto

2条回答
  •  春和景丽
    2020-12-05 16:52

    For Linux, see man 2 mremap:

       void *mremap(void *old_address, size_t old_size,
                    size_t new_size, int flags, ... /* void *new_address */);
    

    mremap() expands (or shrinks) an existing memory mapping, potentially moving it at the same time (controlled by the flags argument and the available virtual address space).

提交回复
热议问题