×

Discussion Board

Results 1 to 4 of 4

Thread: Memoryleak

  1. #1
    Regular Contributor
    Join Date
    Apr 2006
    Posts
    105

    Memoryleak

    Hi all,
    I developed one application,in that i have two classes

    void xxxxx::HandleRequestCompleteEvent()
    {
    TInt lCount = iCurrentListPtr->Count();//this is my RpointerArray
    if(lCount > 0)

    {
    CCurrentDetails* lDetailsPtr = (*iCurrentListPtr)[0];//this is my Rpointrarray class of c class
    CLogDetails* lLogToAddPtr=NULL; //this is my another class

    lLogToAddPtr= new (ELeave) CLogDetails();
    CleanupStack::PushL(lLogToAddPtr);
    if(NULL!= lDetailsPtr->iNamePtr)
    {
    lLogToAddPtr->iNamePtr=lDetailsPtr->iNamePtr;//here i am getting leak
    //but i not able to fix this one here these two are HBUfC pointers only
    }
    else if(NULL!= lDetailsPtr->iTelNumberPtr)
    {
    lLogToAddPtr->iTelNumberPtr=lDetailsPtr->iTelNumberPtr;
    }

    CleanupStack::PopAndDestroy(lLogToAddPtr);


    iCurrentListPtr->Remove(0);
    //delete lDetailsPtr;

    }
    }
    when i try to copy the one HBUfC pointer to Another HBufC pointer its leaking why ?any body can please helpme.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: Memoryleak

    What do you mean on "here I am getting leak"? What is the error message?

  3. #3
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: Memoryleak

    What do yoy mean by

    "but i not able to fix this one here these two are HBUfC pointers only "

    If lLogToAddPtr->iNamePtr is a HBufC then it needs to be deleted in lLogToAddPtr's destrutor. If you think HBufC is a pointer to data but doesn't own its data then you need to restudy descriptors.

    Also revise what your decision to comment out deletion of lDetailsPtr.

    And as wizard has pointed out, you don't get a memory leak at the point of copying so your comments for that are confusing, unless when lLogToAddPtr is created it also creates and allocations a HBufC which you aren't deleting on assignment.

  4. #4
    Regular Contributor
    Join Date
    Apr 2006
    Posts
    105

    Re: Memoryleak

    Hi ,
    Reply my question thanks.
    I am all ready deleted in destructor also still it's giving problem.
    Actually i am try to assign one HBUfc pointer to another HBufC pointer it's giving problem.
    If any one reply me.

Similar Threads

  1. Replies: 2
    Last Post: 2003-07-25, 09:48
  2. Replies: 0
    Last Post: 2003-07-24, 22:47
  3. Replies: 1
    Last Post: 2002-07-30, 10:52

Posting Permissions

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