vmem_mmap.c : add function vmem_mmap_top_free
add function vmem_mmap_top_free for future . Signed-off-by: mrdotK <ldys2014@foxmail.com>
This commit is contained in:
parent
c4b96af829
commit
1112ee24a3
1 changed files with 13 additions and 0 deletions
13
vmem_mmap.c
13
vmem_mmap.c
|
@ -94,6 +94,19 @@ vmem_mmap_free(vmem_t *src, void *addr, size_t size)
|
||||||
errno = old_errno;
|
errno = old_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vmem_mmap_top_free(vmem_t *src, void *addr, size_t size)
|
||||||
|
{
|
||||||
|
int old_errno = errno;
|
||||||
|
#ifdef _WIN32
|
||||||
|
VirtualFree(addr, size, MEM_RELEASE);
|
||||||
|
#else
|
||||||
|
(void) mmap(addr, size, FREE_PROT, FREE_FLAGS | MAP_FIXED, -1, 0);
|
||||||
|
#endif
|
||||||
|
vmem_free(src, addr, size);
|
||||||
|
errno = old_errno;
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vmem_mmap_top_alloc(vmem_t *src, size_t size, int vmflags)
|
vmem_mmap_top_alloc(vmem_t *src, size_t size, int vmflags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue