×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    235

    Question Help my memory leaks

    Do increasing stack space in the mmp always increases stacks allowable space in the phone ? I have increased my allowed stack space but my program still leaks memory .
    Also is there any good basic memory management program apart from the following ?
    1. Declare variables in global scope whereever possible .
    2. CleanupStack.
    3. User::CompressAllHeaps (Is there any equivalence in stack ?)
    4. Take more resources from rss , reduce dynamic declaration
    5. Heap variables to replace stack ones .
    6. Less datatype inter-conversions .

    Also does image heap results in memory leaks ? I have so many images here .

  2. #2
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Help my memory leaks

    Hi,
    Memory leaks are not because of stack size or heap size it is because of the programmer's mistake of leaving some memory orphan( without deletion).
    Now the memory leak can be because of several errors forgetting to delete the object properly or completely, leaving resource handles open.
    There are different tools to detect memory leak like HookLogger for emulator also Macros like UHEAP_MARK and UNMARK are also practiced to detect memroy leaks.
    Here are some good articles on memory leak in wiki
    http://wiki.forum.nokia.com/index.php/Memory_leaks
    http://wiki.forum.nokia.com/index.ph...ing_techniques
    http://wiki.forum.nokia.com/index.php/Hooklogger
    Maximus
    S60 Developer
    Impossible is nothing

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Help my memory leaks

    Hi,

    as yogpan said - memory leaks are bugs in your C++ code...

    BR
    STeN

    P.S. I think CompressAllHeaps() is deprectaed on S60 3rd.

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

    Re: Help my memory leaks

    As already said, you have some very big misunderstanding on what the stack and heap is - in particular asking if you can compress the stack or if increasing it will remove a memory leak.

    The stack and the heap are things in all computers, maybe you should take some time to read about them as without knowing what they are you can't understand how they can be misused in symbian.
    Last edited by hotcheese; 2008-09-23 at 21:24.

  5. #5
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: Help my memory leaks

    Quote Originally Posted by gigglie View Post
    Do increasing stack space in the mmp always increases stacks allowable space in the phone ? I have increased my allowed stack space but my program still leaks memory .
    Also is there any good basic memory management program apart from the following ?
    1. Declare variables in global scope whereever possible .
    2. CleanupStack.
    3. User::CompressAllHeaps (Is there any equivalence in stack ?)
    4. Take more resources from rss , reduce dynamic declaration
    5. Heap variables to replace stack ones .
    6. Less datatype inter-conversions .

    Also does image heap results in memory leaks ? I have so many images here .
    1) First and foremost make sure that you use cleanup stack, two phase construction where ever required.

    2) Make sure you properly delete all the members in the destructor and free all the resources if any.

    3) Go thru your code and try to check for automatic/temporary/local heap objects and check if you properly delete them, also check if you are allocating memory in a loop somewhere.

    4) Similarly check for any Handles, Generally 'R' Classes, make sure that you close/release them properly, try using CleanupClosepushL() with them.

    These are the things that can be kept in the mind, but of course you have a memory leak already and hooklogger is one tool i use for detecting memory leaks, and it works quite well.

Similar Threads

  1. Tracking memory leaks
    By nadav70 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 4
    Last Post: 2007-12-05, 21:00
  2. getResourceAsStream leaks memory on S60
    By copperdragon in forum Mobile Java General
    Replies: 18
    Last Post: 2005-09-13, 14:56
  3. Memory leaks
    By ManishPatil in forum Symbian
    Replies: 0
    Last Post: 2004-12-09, 11:55
  4. Memory Leaks
    By abhishekmishra in forum Symbian
    Replies: 1
    Last Post: 2002-08-21, 15:44
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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