×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159

    CAknRadioButtonSettingPage memory leak?

    I've just added a setting that uses a CAknRadioButtonSettingPage to my settings page, and it's caused a memory leak on exit.

    Previously I was just using a CAknListQueryDialog to popup a list, but realised I should be using a proper settings page rather than just popping up a list.

    So I replaced the popup list with this CAknRadioButtonSettingPage, and start getting a memory leak. The problem lines are:

    CAknRadioButtonSettingPage* page = new (ELeave) CAknRadioButtonSettingPage(R_APN_CONFIG_PAGE, selected, apArray);
    int result = page->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted);

    If these lines are present, the memory leak occurs, if they're not present evenrything works fine (proving that the apArray and other bit are being cleaned up properly).

    The memory that's leaking is not anything I can put my finger on. I can see where it is in memory (about 0x4000 higher than current stack items), and I can see it changes during the ExecuteLD(). It seems to start with a pointer to another section of memeory that also updates on ExecuteLD(). But now I'm stuck.

    Does anyone know what's going on here? Is there something I have to do after the ExecuteLD() to clean up after the CAknRadioButtonSettingPage?


    Cheers
    Russell

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    I still can't get rid of this leak. I've also noticed on the newsgroups that someone else had this problem before me. Unfortunately the only reply he got was "use the cleanup stack"; which I'm sure he had already tried before posting, and I know I did (although I'm not saying I used it in the right way...)

    I've also noticed that there are no examples that use CAknRadioButtonSettingPage. Could this be for a reason? :)

    I'd really appreciate it if someone from Nokia could confirm whether there is a memory leak with CAknRadioButtonSettingPage. If there is a leak and you don't tell developers about it, you'll have a lot of leaking 3rd party apps that make your phones look bad. If there isn't a leak, just tell me and make me look silly for making such a fuss over this.


    Cheers
    Russell

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    OK - time to escalate this... Frankly I think it's a disgrace that I have to escalate something as trivial as this requiring a one-word answer.


    Disgusted.
    Tunbridge Wells.

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    Gees... escalating things is bloody expensive. Ontop of being a Forum Pro member you've got to shell out €400 to ask a single question. Nice way to make money out of developers trying to support Symbian!!!

  5. #5
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169
    hmmm.. I though it was 100 euroes for pro-members. anyway as long as the support site says 500 Euroes, it is free (at least that what they told me), and you have full month to ask plenty of many questions.

    The quality and speed is sometimes really excellent there, also if you managed to point out system problems, you might have very early access to non-public parts that fixes the problem (I don't think this is official thing, but they'll do it if necessary case-by-case basis).

    yucca

  6. #6
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    My boss is still reading the NFP details and deciding whether we want to pay NFP hundreds of Euros for a simple questio like this...

    In the meantime I noticed that the Settings app (run on the emulator) manages to use CAknRadioButtonSettingPage (or something that looks exactly like it) without this error occuring. So it must be something I'm doing wrong that's causing the problem...

  7. #7
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86

    confirmation?

    hi..

    i would just like to ask if CAknRadioButtonSettingPage really causes memory leak? i just need a confirmation. thank you very much.

  8. #8
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    Are you taking care of apArray? I think that it is not owned by CAknRadioButtonSettingPage...

  9. #9
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86
    yes, i am deleting the apArray in the destructor.

    i instantiate it like this:
    Code:
    if(apArray)
    	{
    	delete apArray;
    	apArray = NULL;
    	}
    apArray = new(ELeave) CDesCArrayFlat(2);
    CleanupStack::PushL(apArray);
    apArray->AppendL( _L("None") );
    apArray->AppendL( _L("User Defined") );
    CleanupStack::Pop(apArray);
    and i have this in my destructor:
    Code:
    delete apArray;
    apArray = NULL;
    im quite sure the CAknRadioButtonSettingPage has a problem.. i tried deleting it in the destructor (delete page;) and it does not want to compile. i've also tried putting CleanupStack::PushL and Pop after instantiating the setting page and before ExecuteLD, it gives me kern-exec 3.

  10. #10
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86
    oops.. sorry... i found it... i found out i wasn't deleting the settings data... *embarassed* sorry...

  11. #11
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86
    oops... another oops... i take it back.. it still has memory leak.. im very sorry for my confusing posts....

  12. #12
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Estonia
    Posts
    350

    Re: CAknRadioButtonSettingPage memory leak?

    Now I stumbled into it. Has nobody found any solution to it yet

  13. #13
    Registered User
    Join Date
    Oct 2003
    Location
    USA
    Posts
    9

    Re: CAknRadioButtonSettingPage memory leak?

    Just to finish this thread, it is possible that the memory leak reported here is caused by pushing an MDesCArray pointer onto the CleanupStack:

    MDesCArray* array = new (ELeave) CDesC16ArrayFlat(itemCount);
    CleanupStack::PushL(array);

    // create and show CAknRadioButtonSettingPage

    CleanupStack::PopAndDestroy(); // array

    This code compiles and runs okay, but since MDesCArray is a mixin and doesn't derive from CBase, there is a memory leak. The code should look like this:

    CDesC16ArrayFlat* array = new (ELeave) CDesC16ArrayFlat(itemCount);
    CleanupStack::PushL(array);

    // create and show CAknRadioButtonSettingPage

    CleanupStack::PopAndDestroy(); // array

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    32

    Re: CAknRadioButtonSettingPage memory leak?

    To finally finish this thread, the memory leak (and possibly some other visual problems like skin problems on some devices that were not mentioned here) are caused by a missing ConstructL():

    CAknRadioButtonSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage(R_SET_LIST_PAGE, iValue, iValuesArray);
    dlg->ConstructL();
    if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted))
    {
    ...
    }

Posting Permissions

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