When looking at any given Wt C++ example, there are a lot of new calls but how do these even get deleted? Also, are these even guaranteed to be deleted and if so, when/where?
EDIT: This link pretty much answered how it's probably also done in Wt, although it doesn't directly speak about Wt. Why does the use of 'new' cause memory leaks?
It is a little unsettling to see
new
s without matchingdelete
s..Wt takes ownership of
Wt::Widget
pointers that are added to a page or widget hierarchy. They are deleted automatically, as needed.Very soonNow, a new Wt 4.0 release will clarify this by requiring you to movestd::unique_ptr
s to these functions, so it is unambiguous that you are transferring ownership. Likewise, functions that remove widgets will returnunique_ptr
s to the calling code.