×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    40

    Clearing Heap Memory

    Hi all....
    Can i clear the heap memory before starting my app by using this line of code?
    "Runtime.getRuntime().freeMemory()" //TO CLEAR HEAP MEMORY.
    "Runtime.getRuntime().totalMemory()" //TO GET TOTAL HEAP MEMORY.
    if yes where should i need to add this line of code?
    Thank You.

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

    Re: Clearing Heap Memory

    Quote Originally Posted by Suresh_S View Post
    Hi all....
    Can i clear the heap memory before starting my app by using this line of code?
    "Runtime.getRuntime().freeMemory()" //TO CLEAR HEAP MEMORY.
    "Runtime.getRuntime().totalMemory()" //TO GET TOTAL HEAP MEMORY.
    if yes where should i need to add this line of code?
    Thank You.
    I'm not certain what API that is thus can not be sure of the functionality, anyway, I suppose the freeMemory propably just returns the amount of free memory without doing any freeing really.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    40

    Re: Clearing Heap Memory

    Thanks symbianyucca.
    then how can i clear the heap memory before starting my application?

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Clearing Heap Memory

    Generally you can not, system will take care of shutting down application that are not on foreground, once the RAM memory goes low. Thus you should mainly concentrate on managing the memory you are using, and clearing it once it is not needed anymore.

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    40

    Re: Clearing Heap Memory

    Thanks Yucca

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,567

    Re: Clearing Heap Memory

    Moved to the Java boards if you do not mind.

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    40

    Re: Clearing Heap Memory

    Hi wizard...
    I have added this in .cpp file and
    TInt WatchMem(TAny *)
    {
    TBuf<20> buf;
    TInt size;
    TInt count=User::AllocSize(size);
    _LIT(KFormat,"%d/%d");
    buf.Format(KFormat,size,count);
    User::InfoPrint(buf);
    return 1;
    }

    And This Line
    CPeriodic::NewL(EPriorityStandard)->Start(1000000,1000000,TCallBack(WatchMem));

    but i'm getting this error.
    please help me.
    function call '[TCallBack].TCallBack(int (CGlobalCapturer::*)(void *))' does not match

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Clearing Heap Memory

    Suresh_S... is this related to your original post?

    For a new problem, please start a new discussion thread. And please post Java questions in the Java discussion area and C++ questions in the C++ discussion area.

    Graham.

Similar Threads

  1. Clearing heap and stack while writing to file
    By emorgen in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2008-12-03, 19:26
  2. Memory Heap & OS Heap
    By earamsey in forum Mobile Java General
    Replies: 0
    Last Post: 2007-08-27, 23:02
  3. Heap memory
    By vishwas_vincy11 in forum Symbian C++
    Replies: 1
    Last Post: 2006-12-06, 19:00
  4. Heap memory
    By Vyts in forum Mobile Java General
    Replies: 1
    Last Post: 2004-01-18, 11:52
  5. clearing of cache memory
    By andy78 in forum Symbian C++
    Replies: 0
    Last Post: 2003-10-13, 05: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
  •