ext/eigen/eigen3/Eigen/src/Core/util/Memory.h in ruby-eigen-0.0.11.pre1 vs ext/eigen/eigen3/Eigen/src/Core/util/Memory.h in ruby-eigen-0.0.11.pre2
- old
+ new
@@ -101,10 +101,11 @@
/** \internal Like malloc, but the returned pointer is guaranteed to be 16-byte aligned.
* Fast, but wastes 16 additional bytes of memory. Does not throw any exception.
*/
inline void* handmade_aligned_malloc(std::size_t size)
{
+ rubyeigen_gc_add_count(size);
void *original = std::malloc(size+16);
if (original == 0) return 0;
void *aligned = reinterpret_cast<void*>((reinterpret_cast<std::size_t>(original) & ~(std::size_t(15))) + 16);
*(reinterpret_cast<void**>(aligned) - 1) = original;
return aligned;
@@ -210,11 +211,11 @@
* On allocation error, the returned pointer is null, and std::bad_alloc is thrown.
*/
inline void* aligned_malloc(size_t size)
{
check_that_malloc_is_allowed();
-
+ rubyeigen_gc_add_count(size);
void *result;
#if !EIGEN_ALIGN
result = std::malloc(size);
#elif EIGEN_MALLOC_ALREADY_ALIGNED
result = std::malloc(size);
@@ -302,10 +303,10 @@
}
template<> inline void* conditional_aligned_malloc<false>(size_t size)
{
check_that_malloc_is_allowed();
-
+ rubyeigen_gc_add_count(size);
void *result = std::malloc(size);
if(!result && size)
throw_std_bad_alloc();
return result;
}