×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    64

    memory allocation/fragmentation

    Hello,

    I had following experience on my Nokia 6600 : my application needs around 1.7 MB of heap memory to run and consists of four modules that all allocate memory at different times. At startup, the first three modules allocate memory almost worth the 1.7 MB. At some stage in the program, module 3 frees its memory ( which is the biggest chunk, around 1 MB ) and then allocates again. Also, module 4 allocates memory but runs out of it, although it needs not much. Modules 1 and 2 stay untouched all the time.

    What puzzles me a bit, is that the overall memory consumption in the startup situation is higher than later in the program and there it does not run out of memory.

    So far, I don't feel desperate about this problem, yet. My guess is that the cause is some memory fragmentation. Anyone have an idea?
    Also, does anyone know how memory is allocated ( always seqential chunks, beginning at "lowest" address? ) ?

    Also, is it possible to defragment the heap during runtime? I heard something like this but don't know.

    Thanks for any suggestions!!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144
    maybe you could have a look into the User class, it has some sort of function that compresses the heap memory areas, it could maybe help you a bit.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    64
    Hello symbianyucca,

    thanks for your reply. I tried to simulate the situation on the EPOC emulator by decreasing the MB of free mem in the .ini file. Then I played with the "User::Available" function but strangely it always told me the same amount of free memory, no matter what MB I entered in the .ini file...? What's this?

    By now, I think the reason is some bug in my program because I found out that my 6600 has huge heap memory... I wrote another post about it in the "Devices/Phones" section of this forum, "General Discussion". Maybe you can help me there, too.

    Thank you again!

  4. #4
    Regular Contributor
    Join Date
    Feb 2004
    Posts
    51
    I think what's really important is to look at the biggest available memory block (User::Available(biggest)). You can have lots of free memory, but if it is fragmented it is not of much use if you try to allocate a lot of mem at once.

Posting Permissions

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