util/HugeAllocator: add "noexcept"
This commit is contained in:
parent
ef053035d0
commit
9500343d85
@ -81,13 +81,13 @@ HugeAllocate(size_t size) throw(std::bad_alloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HugeFree(void *p, size_t size)
|
HugeFree(void *p, size_t size) noexcept
|
||||||
{
|
{
|
||||||
munmap(p, AlignToPageSize(size));
|
munmap(p, AlignToPageSize(size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HugeDiscard(void *p, size_t size)
|
HugeDiscard(void *p, size_t size) noexcept
|
||||||
{
|
{
|
||||||
#ifdef MADV_DONTNEED
|
#ifdef MADV_DONTNEED
|
||||||
madvise(p, AlignToPageSize(size), MADV_DONTNEED);
|
madvise(p, AlignToPageSize(size), MADV_DONTNEED);
|
||||||
|
@ -52,7 +52,7 @@ HugeAllocate(size_t size) throw(std::bad_alloc);
|
|||||||
* @param size the allocation's size as passed to HugeAllocate()
|
* @param size the allocation's size as passed to HugeAllocate()
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
HugeFree(void *p, size_t size);
|
HugeFree(void *p, size_t size) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discard any data stored in the allocation and give the memory back
|
* Discard any data stored in the allocation and give the memory back
|
||||||
@ -63,7 +63,7 @@ HugeFree(void *p, size_t size);
|
|||||||
* @param size the allocation's size as passed to HugeAllocate()
|
* @param size the allocation's size as passed to HugeAllocate()
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
HugeDiscard(void *p, size_t size);
|
HugeDiscard(void *p, size_t size) noexcept;
|
||||||
|
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -73,13 +73,13 @@ void *
|
|||||||
HugeAllocate(size_t size) throw(std::bad_alloc);
|
HugeAllocate(size_t size) throw(std::bad_alloc);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
HugeFree(void *p, gcc_unused size_t size)
|
HugeFree(void *p, gcc_unused size_t size) noexcept
|
||||||
{
|
{
|
||||||
VirtualFree(p, 0, MEM_RELEASE);
|
VirtualFree(p, 0, MEM_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
HugeDiscard(void *p, size_t size)
|
HugeDiscard(void *p, size_t size) noexcept
|
||||||
{
|
{
|
||||||
VirtualAlloc(p, size, MEM_RESET, PAGE_NOACCESS);
|
VirtualAlloc(p, size, MEM_RESET, PAGE_NOACCESS);
|
||||||
}
|
}
|
||||||
@ -98,14 +98,14 @@ HugeAllocate(size_t size) throw(std::bad_alloc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
HugeFree(void *_p, size_t)
|
HugeFree(void *_p, size_t) noexcept
|
||||||
{
|
{
|
||||||
auto *p = (uint8_t *)_p;
|
auto *p = (uint8_t *)_p;
|
||||||
delete[] p;
|
delete[] p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
HugeDiscard(void *, size_t)
|
HugeDiscard(void *, size_t) noexcept
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user