I use VirtualTreeView in C ++ Builder and use it with a structure like this:
struct TVTNodeData
{
int Index;
UnicodeString Caption;
}
I prefill the nodes of the tree using a loop that has this:
TVirtualNode *Node = VTree->AddChild(NULL);
pNode = (TVTNodeData *)VTree->GetNodeData(Node);
pNode->Index = 1;
pNode->Caption = "Whatever";
I noticed that the memory for the application is constantly increasing (memory leak), although I clear the tree and reload it. This page - http://www.remkoweijnen.nl/blog/2010/06/09/memory-leaks-when-using-virtual-treeview-component/ recommends doing Finalize () in the event OnFreeNode. Okay bye.
But in C ++ there is no Finalize (). I tried pNode->Caption=""in the OnFreeNodeevent and the memory is no longer allocated, but it is still a bit. I think there may be a link to the UnicodeString on the left, even if it is empty (number of links> 0).
node OnFreeNode UnicodeString ++? , UnicodeString , - ?
, , node OnNodeInit - OnFreeNode?
, TVTNodeData - node AddChild, OnNodeInit, Finalize, ?
:. , , , . , , struct-destructor Finalize, , ( ).