×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    germany
    Posts
    14

    Question Holding multiple bitmaps in memory

    Hi all,
    I'm doing some image processing on a bitmap I load from an mbm file. The program computes different gradients of the image and eventually combines them in one. My question is now, what is the most efficient way to handle several temporary versions of one image?

    Creating 6 CFbsBitmap (EGray256) in one function would probably cause a big overhead.

    For some reason, if I try using pointers to hold the temp values (to copy them into the final image after all the processing is done), the app crashes without any error message:

    Code:
        TUint8 * tmp=new TUint8[imgSize];
    
        iBitmap->LockHeap(ETrue); // lock global heap 
        TUint8* final = (TUint8*)iBitmap->DataAddress();
        iBitmap->UnlockHeap(ETrue);
    this works, and I can access "final", but trying something like
    Code:
        tmp[0] = 255;
    crashes it.

    What is the most efficient way to store those temporary values? Is this just a standard C++ pointer problem?

    Thanks for your help.
    Last edited by sbail; 2009-08-12 at 00:23.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: Holding multiple bitmaps in memory

    Enable the error messages: http://wiki.forum.nokia.com/index.ph...ded_panic_code
    Note that "new TUint8[imgSize]" returns a NULL pointer when it runs out of memory - if you get a KERN-EXEC 3 panics, probably this is the case.
    You can increase the size of your heap (default maximum size is 1 megabyte) using the EPOCHEAPSIZE keyword in the .mmp (.mmp editor in Carbide.c++ also offers it on one of its pages).

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    germany
    Posts
    14

    Re: Holding multiple bitmaps in memory

    Thanks for your quick reply - on Exit() the program leaves with a KERN-EXEC 3 panic, but not during execution. When I try to use the emulators debug now function, the emulator crashes, haha.

    I'll try and change the heap size, does that normally solve memory problems? (My program is only a prototype and optimised for an N95, does not need to be compatible with other phones )

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: Holding multiple bitmaps in memory

    In your first post you wrote that "tmp[0]=255" dies, and that could be a memory problem. Now decide if it dies or not.
    About the emulator issue, check http://wiki.forum.nokia.com/index.ph...arbide.c%2B%2B

  5. #5
    Registered User
    Join Date
    Oct 2006
    Location
    germany
    Posts
    14

    Re: Holding multiple bitmaps in memory

    Sorry, the description of the crash was not quite clear, due to the fact that the behaviour and crashes changed with every run (and I couldn't spot a pattern...).

    I've increased the heap size now and it seems stable, no more crashes. So I guess the problem is solved... learned something new today.

    Thanks for your help!

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: Holding multiple bitmaps in memory

    Note that if you use the Symbian-ish
    Code:
    TUint8 * tmp=new (ELeave) TUint8[imgSize];
    syntax, you would always get a clear notification about out of memory situations (a leave with KErrNoMemory).

Similar Threads

  1. Multiple Memory Model
    By heuven in forum Symbian
    Replies: 7
    Last Post: 2008-11-03, 15:11
  2. s60 3rd ed emulator crash
    By Kimau in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2008-06-18, 22:12
  3. Replies: 2
    Last Post: 2005-07-25, 06:07
  4. Replies: 2
    Last Post: 2004-01-08, 18:36
  5. Some memory related and other issues
    By sanjg2k1 in forum General Development Questions
    Replies: 0
    Last Post: 2003-07-07, 17:38

Posting Permissions

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