Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    197

    Need to disconstruct T-class?

    Hi friends,

    I wrote some class ,and I new an instance of it like the following

    Code:
    class TParameter
    	{
    public:
    	TBuf8<KMaxItemNameBufLength>	iParameterName;
    	TBuf8<KMaxItemContentBufLength>	iParameterValue;
    	TParameter*	iNextPara;
    	};
    
    TParameter* para = new TParameter();
    After para is used,I do not delete it and let it go,
    would this lead to memory leak? Do I need to disconstruct it after it is not used any more??

    Thank you.
    //---------------------------------------------------------------------------------
    Stand on the shoulders of the Great and build a better world.
    //---------------------------------------------------------------------------------

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Need to disconstruct T-class?

    most often you would not use new with T-Classes, so then they would behave like automatic variables, anyway, if you choose to use new then of course you should delete it. anyway, do note that you should change the implementation to be real C-Class, derived from a CBase, this would ensure that the class destructor would also be called,.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,807

    Re: Need to disconstruct T-class?

    Quote Originally Posted by leejx View Post
    After para is used,I do not delete it and let it go,
    would this lead to memory leak?
    This is the definition of a memory leak, what else have you expected? Not 'would', not even 'will', it does
    Do I need to disconstruct it after it is not used any more??

Similar Threads

  1. Replies: 9
    Last Post: 2009-01-06, 14:22
  2. C++ Symbols class(), class()->,class. ????
    By PACALA_BA in forum Symbian
    Replies: 7
    Last Post: 2008-09-15, 20:57
  3. Replies: 0
    Last Post: 2004-03-03, 11:34
  4. How to convert 'class TBuf8<60>' to 'const class TDesC16 &'
    By wingfancy in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-05-08, 12:58
  5. Replies: 2
    Last Post: 2003-03-18, 07:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×