Ok; If you create your panel like this, the BMAP allocated memory will be freed with the PANEL when you ptr_remove it.

I think that ptr_remove is the same as pan_remove (But I'm not sure).