Meanwhile I came a bit closer to the problem.
The function shown bellow freezes on MemPtrSize() and similar calls even if
called immediatelly at the program beginning.
SayText() is just a simple printf-style alert; TestBmpAlloc() will freeze
even if it is removed.
This sequence of calls:
- works on emulator
- does not work on Thungsten and m515 (but it used to work before!)

static void TestBmpAlloc()
{
 Err error ;
 BitmapType *bmp = BmpCreate( 40, 40, 16, NULL, &error );
 if( error )
 {
  SayText( "error" ) ;
 }
 else
 {
  SayText( "Bmp Created -> %lx", bmp ) ;    // reports 001B70BC
  SayText( "In storage: %s", MemPtrDataStorage(bmp) ? "yes":"no" ) ;    //
freezes (reset needed)
  SayText( "heapId %d", MemPtrHeapID(bmp) ) ;   // freezes (reset needed)
  SayText( "SIZE %ld", MemPtrSize(bmp) ) ;   // freezes (reset needed)
 }
}

In my opinion the code is legal and in agreement with Palm OS Reference.
The reason why I need a sequence like that is that I want to store the
bitmap (into a PDB) and later restore.

Jan Slodicka



> Hi
>
> I have a very strange problem: The MemPtr call bellow never returns when
run
> on the device (both on Thungsten and m515) .
>     BitmapPtr dibPtr = BmpCreate( 24, 24, 16, NULL, &error );
>     // ... Here are the dib bits filled and lot of other things done
>     dataSize = MemPtrSize( dibPtr ) ;
>
> Here is what I checked:
> - pointer value (0x1B43E0 seems to be reasonable)
> - Calling MemHeapCheck() just before MemPtrSize() returns with success.
> - There is plenty of free dynamic memory in this moment
> - Calling MemPtrHeapID(dibPtr) just before MemPtrSize() freezes as well.
> - Identical code runs error-free on several debug roms
> - hard reset did not help
> - I reviewed the code if there is proper error checking - it seems like
> everything is checked
>
> The code used to run safely until some changes were done in seemingly
> unrelated part of the program.
> The application has several segments. This part is in the 1st segment
whose
> size is pretty close to 64K. I tried to switch off several files from the
> project or move to another segment ... no change.
>
> The whole thing reminds me the deadlock situation, but I don't know how
this
> can happen on Palm, resp. how could I cause it.
>
> Can anybody give me some advice what to check additionally?



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to