×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    209

    CAknListQueryDialog memory leak , Could you please help me to find the memory leak ?

    Hi All,

    I am using CAknListQueryDialog class for showing the pop up, but below code is giving alloc) may be there is some memory leak.

    Could you please help me to find the memory leak ?

    Int CMyClass:ShowPopupListL(CDesCArrayFlat* aOptionListArray, const TDesC& aHeadingText) // aOptionListArray is owned by caller of this function
    {
    TInt itemSelected=0;

    CAknListQueryDialog* popupMenu = new (ELeave) CAknListQueryDialog(&itemSelected);
    CleanupStack:ushL(popupMenu);

    if (aHeadingText.Length() > 0)
    {
    popupMenu->PrepareLC(R_DIALOG_POPUP_MENU_HEADING);
    CAknPopupHeadingPane * heading = popupMenu->QueryHeading();
    heading->SetTextL(aHeadingText);
    }
    else
    {
    popupMenu->PrepareLC(R_DIALOG_POPUP_MENU);
    }

    popupMenu->SetItemTextArray(aOptionListArray);
    popupMenu->SetOwnershipType(ELbmDoesNotOwnItemArray);

    CleanupStackp(popupMenu);

    if (popupMenu->RunLD())
    {
    return itemSelected;
    }
    return KErrCancel;
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,752

    Re: CAknListQueryDialog memory leak , Could you please help me to find the memory lea

    PrepareLC and RunLD does Cleanup Stack coverage, so you do not need the PushL+Pop.
    However, speaking of Cleanup Stack: it is a dynamic thing, and it may extend any time, and never shrinks. So if it extends in a UHEAP_MARK-MARKEND block, you will see a leak. So extending the Cleanup Stack beforehand may cure the apparent leak (just Push 5-10 something and Pop them).
    It may also matter how you check for leaks.

Similar Threads

  1. how to find memory leak in Qt?
    By hsany330 in forum [Archived] Beginning Qt
    Replies: 2
    Last Post: 2011-06-03, 12:11
  2. How we can Find Memory Leak in GUI Application
    By pranay_preet in forum Symbian
    Replies: 2
    Last Post: 2009-02-16, 09:27
  3. memory leak on emulator = memory leak on device
    By manmli in forum Mobile Java General
    Replies: 2
    Last Post: 2006-08-05, 19:54
  4. Memory Leak in the CAknListQueryDialog.
    By mahavirjain in forum Symbian
    Replies: 0
    Last Post: 2006-07-03, 07:44
  5. Pls help me find if there is a memory Leak??
    By akosipedro in forum Symbian
    Replies: 2
    Last Post: 2006-02-02, 07:53

Posting Permissions

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