Gromacs
2025-dev-20241003-bd59e46
|
Functions | |
gmx_unused void * | alignedMallocGeneric (std::size_t bytes, std::size_t alignment) |
Allocate aligned memory in a fully portable way. More... | |
gmx_unused void | alignedFreeGeneric (void *p) |
Free aligned memory. More... | |
void * | mallocImpl (std::size_t bytes, std::size_t alignment) |
Implement malloc of bytes of memory, aligned to alignment . | |
void | freeImpl (void *p) |
Free aligned memory allocated with mallocImpl(). | |
gmx_unused void gmx::anonymous_namespace{alignedallocator.cpp}::alignedFreeGeneric | ( | void * | p | ) |
Free aligned memory.
p | Memory pointer previously returned from gmx::internal::alignedFreePortable(). |
Since this routine relies on the original pointer being stored just before the memory area p points to, bad things will happen if you call this routine with a pointer obtained any other way, or if you call the system free() with a pointer obtained from std::alignedMalloc().
gmx_unused void* gmx::anonymous_namespace{alignedallocator.cpp}::alignedMallocGeneric | ( | std::size_t | bytes, |
std::size_t | alignment | ||
) |
Allocate aligned memory in a fully portable way.
bytes | Amount of memory (bytes) to allocate. The routine will return nullptr if the allocation fails. However, note that asking for zero bytes will return a pointer that is non-null and properly aligned (but obviously you cannot use it, since you promised not to access data beyond the 0 bytes you asked for). |
alignment | Alignment specification in bytes, must be a power of 2. |