MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / aligned_malloc

Function aligned_malloc

include/Eigen/src/Core/util/Memory.h:199–221  ·  view source on GitHub ↗

\internal Allocates \a size bytes. The returned pointer is guaranteed to have 16 or 32 bytes alignment depending on * the requirements. On allocation error, the returned pointer is null, and std::bad_alloc is thrown. */

Source from the content-addressed store, hash-verified

197 * the requirements. On allocation error, the returned pointer is null, and std::bad_alloc is thrown.
198 */
199EIGEN_DEVICE_FUNC inline void* aligned_malloc(std::size_t size) {
200 if (size == 0) return nullptr;
201
202 void* result;
203#if (EIGEN_DEFAULT_ALIGN_BYTES == 0) || EIGEN_MALLOC_ALREADY_ALIGNED
204
205 check_that_malloc_is_allowed();
206 EIGEN_USING_STD(malloc)
207 result = malloc(size);
208
209#if EIGEN_DEFAULT_ALIGN_BYTES == 16
210 eigen_assert((size < 16 || (std::size_t(result) % 16) == 0) &&
211 "System's malloc returned an unaligned pointer. Compile with EIGEN_MALLOC_ALREADY_ALIGNED=0 to fallback "
212 "to handmade aligned memory allocator.");
213#endif
214#else
215 result = handmade_aligned_malloc(size);
216#endif
217
218 if (!result && size) throw_std_bad_alloc();
219
220 return result;
221}
222
223/** \internal Frees memory allocated with aligned_malloc. */
224EIGEN_DEVICE_FUNC inline void aligned_free(void* ptr) {

Callers 6

runMethod · 0.85
aligned_reallocFunction · 0.85
allocateMethod · 0.85

Calls 3

handmade_aligned_mallocFunction · 0.85
throw_std_bad_allocFunction · 0.85

Tested by

no test coverage detected