On 27/09/2015 12:14, Michael S. Tsirkin wrote: > - if (total > size) { > - munmap(ptr + size, total - size); > + if (total > size + getpagesize()) { > + munmap(ptr + size + getpagesize(), total - size - getpagesize()); > } >
Please add a comment here, also noting that "total" always allocates at least an extra page, even if size is already aligned. > if (ptr) { > - munmap(ptr, size); > + munmap(ptr, size + getpagesize()); > } And another comment here. Paolo