When you remove items from the list view, you are responsible for clearing any resources referenced by the lParam element of the LVITEM structure; the Windows API will not do this for you.
In fact, the Windows API cannot do this for you. He does not know if the pointer points to the memory allocated using new , malloc , IMalloc or any other allocator. Or maybe the pointer points to a statically allocated array and does not need to be freed at all. Or it may not even be a pointer, but rather a hash value for sorting or an index into some other structure.
Since only you know how to interpret lParam, all responsibility for resource management lies with you. Unlike some opinions , C ++ will not help you here.
source share