×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    30

    Thumbs up Error Note memory leak

    I am using the following code to display error note

    Code:
    if(error != KErrNone) {
    	CAknErrorNote *aErrorNote = new (ELeave) CAknErrorNote();
    	aErrorNote->ExecuteLD(_L("System Error ")) ;
    }
    but this leaks memory - I am printing out the value of user.Heap().Size() after showing this note and it keeps increasing.

    If I delete the aErrorNote i get Kern-Exec 3 error, Can anyone please tell me the right way of displaying an error note.

    Thanks,
    Budugu

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

    Re: Error Note memory leak

    it should not really leak, since the LD ending means that the dialog is destroyed after the is shown.

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

    Re: Error Note memory leak

    There can be many unseen things happening in the background:
    - the note control loads a resource: it may easily happen that CCoe/EikonEnv decides to keep the resource in the memory for possible further usages - so it is an allocation, but it is not a leak
    - a simpler thing which can also happen is the expansion of the Cleanup Stack.

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    30

    Re: Error Note memory leak

    Thanks for the info. I was a bit worried to see the Heap size increase whenever error note is shown, if this is the right way to show an error note then so be it.

    Thanks,
    Budugu

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,683

    Re: Error Note memory leak

    If memory allocation increases on every single invocation, that is not a nice thing. Note that the emulator checks for memory leaks on exiting a GUI application, so you could test the notes there.
    You may have to enable the error messages first: http://wiki.forum.nokia.com/index.ph...ded_panic_code
    After that you can simply try generating some test project, and putting an explicit memory leak into it (writing "User::Alloc(1);" into HandleCommandL will do the job). You should get an ALLOC panic in return.

Similar Threads

  1. memory leak
    By manjusg in forum Symbian
    Replies: 8
    Last Post: 2009-07-30, 06:04
  2. select error -1 and Memory leak
    By paipeng in forum Open C/C++
    Replies: 2
    Last Post: 2009-04-24, 12:49
  3. Memory leak
    By Bill_Murray in forum Symbian
    Replies: 7
    Last Post: 2008-01-12, 08:23
  4. memory leak
    By sandy_zeng in forum Symbian
    Replies: 5
    Last Post: 2007-08-08, 09:46
  5. memory leak on emulator = memory leak on device
    By manmli in forum Mobile Java General
    Replies: 2
    Last Post: 2006-08-05, 19:54

Posting Permissions

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