set_donttouchdata#

Declare that the ndarray’s storage belongs to someone else.

$pdl->set_donttouchdata; $pdl->set_donttouchdata($nbytes);

After this the ndarray will not free its own data when it goes away - the caller who supplied that memory is responsible for it. With a size argument, the ndarray also records that many bytes as its extent. Returns 1.

This is how a memory-mapped ndarray is set up, by set_data_by_file_map and hence by PDL::IO::FastRaw::mapfraw. Setting it on an ndarray whose data PDL did allocate leaks that data.