c++ - mremap 是否与 malloc 一起使用?

标签 c++ c linux memory malloc

void * mremap(void *old_address, size_t old_size , size_t new_size, unsigned long flags);

与 malloc() 兼容吗?

GCC (C++) 和使用 Linux。

谢谢。

最佳答案

不,不是。除了 malloc 不需要在页面边界给你一个地址(这是 mremap 所期望的)这一事实之外,弄乱内存映射是很危险的来自 mallocmalloc 不知道你做了它。请改用 realloc

关于c++ - mremap 是否与 malloc 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7377257/

相关文章:

c++ - 如何在c++中获取 map 类型指针, map

c++ - 计算将 n 划分为正整数之和的方法数 c++

c - 通过函数参数添加到 main 中的数组

c - Linux/生成文件 : Creating a binary that executes as if it were in a specific directory

linux - linux procstat中RES和PRES字段有什么区别

c++ - 使用宏扩展作为标识符的一部分

c - 在 C 或其他程序中 XOR 2 52 字节消息?

c - 运行时错误(堆栈溢出)

linux - last-modified header 和 linux 文件系统

c++ - C++ 结构中的结构