http://www.perlmonks.org?node_id=560139


in reply to Re^3: perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory
in thread perlembed: mortalize an AV, get "Attempt to free unreferenced scalar" - don't mortalize, leaks memory

You probably actually wanted a more recent copy of the source. av_clear doesn't free the memory allocated to the array nor does it free the SVs that form its elements. It simply truncates the array.

/J\