Skip to content

Eigen::Ref stores redundant data

Submitted by Emily

Assigned to Nobody

Link to original bugzilla bug (#884)
Version: 3.2

Description

Consider the following example:

Eigen::ArrayXXd data = Eigen::ArrayXXd::Random(1000, 1000);  



typedef Eigen::Ref<const Eigen::ArrayXXd> datacref_t;  

auto block = data.block(500, 500, 5, 5);  

Eigen::internal::set_is_malloc_allowed(false);  

const datacref_t dataref = block;  

const datacref_t ref = dataref; // Calls malloc with size = 0  

Eigen::internal::set_is_malloc_allowed(true);  

The copy assign operator causes a call to malloc with what looks to be a zero sized alloc. This is still a system call and is causing performance issues for me.

Also we're using application verifier to catch memory handling problems early, it works by putting each memory allocation in it's own page and doing some verifications. A lot of 0 size requests will cause the virtual address space to be rapidly depleted with this tool running.

Depends on

#58

Blocking

#912