More specifically: at the end of the session, Wt will delete the
application object. The entire WObject tree that sits below the
WApplication object will be deleted. The reference documentation of
WObject explains this:

A second feature of WObject is that they allow ownership organization
in ownership object trees. When an object is created with another
object as parent, it's ownership is transferred to the parent. If not
deleted explicitly, the child object will be deleted together with the
parent. Child objects may also be deleted manually: they will remove
themselves from their parent in the process.

parent->addWidget(new WText("blah")) inserts the WText (a WObject) in
the child list of the parent (also a WObject), so when the parent is
deleted, the child is deleted too.

Best regards,
Wim.

2010/3/8 omer katz <[email protected]>:
> This will not cause any memory leak because Wt handles all memory.
>
> 2010/3/8 <[email protected]>
>>
>> Hi,
>>
>> I see this kind of function call in the mailing list and
>> the documentation of Wt.
>>
>> But I'm really not sure about this function call:
>>
>>     > addWidget(new WText("this is page2"));
>>
>> Does it will cause memory leak or not?
>>
>> I'm really not sure, so want to get an answer.
>>
>> >>> Page2()
>> >>> {
>> >>>     addWidget(new WText("this is page2"));
>> >>>     std::cout << "Page2 is loaded" << std::endl;
>> >>> }
>>
>> ---
>> B.R.
>> Jiongliang
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to