> so... the system calls it when you try to allocate memory. in what > situation would it be advantageous to call it explicitly?
probably none - but, his problem is most likely not enough free contigous ram. i doubt you can fix it is explicitly once it is fragmented - thats realy an OS task. there may be a hidden API for it somewhere :) > >we have a trick on pre OS5 thats how we were able to have > 400k > of dynamic ram even on palmos 3.1 OS5 removed that ability, so, like > you, we were stuck with dynamic heap only > > semaphore lock? But that works in OS5...so...uh...hmmm...oo, he's > teasing us! no semaphore lock :) we had over 400k of windows allocated (offscreen), which could be used with WinCopyRectangle() et al. its impossible to create more windows than is physically available on the heap :) in lemmings, we have a lot of sprites.. one advantage was that once they were created, we didn't need to have write access to the windows, only read access :) this code is > 2 years old now - so, what the heck *g* // the WinCreateBitmapWindow() routine performs some checks on the data // that is provided when creating a window. for data protection reasons // the BitmapType* data chunk MUST exist in the dynamic heap - as it is // normally "written" to by the other API routines - without semaphores // // winLemmings, winLemmingsMask and winGameMask are "readonly" graphics // resources in the game, so, we have to hack around this :) we have to // fool the Palm OS, by creating a small bitmap, and then replacing the // bitmap with our "handle" we created earlier. // // -- Aaron Ardiri, 2001 thats the comment in my code :) not to mention: // initialize the bitmap chunks bmpPtr = BmpCreate(SPR_WIDTH, SPR_HEIGHT, globals.scrDepth, NULL, &e); err |= e; globals.winLemmings = WinCreateBitmapWindow(bmpPtr, &e); err |= e; err |= (globals.winLemmings == NULL); if (err != errNone) goto GFX_MEMORY_QUIT; // f**k you palm :P - get around that darn limitation BmpDelete(bmpPtr); bmpPtr = (BitmapType *)MemHandleLock(globals.hanLemmings); globals.winLemmings->bitmapP = bmpPtr; globals.winLemmings->windowBounds.extent.x = bmpPtr->width; globals.winLemmings->windowBounds.extent.y = bmpPtr->height; ... i'll let you figure out the rest *g* but, not a single use of MemSemaphore *g* - that stuff is dangerous; after i wrote this code, i asked Palm if they would allow us to create read-only windows (ie: not on heap), or, at least let us move stuff around after we have created them.. oh well :) heap space is very limited.. use the storage heap as much as you can :) the code i wrote was pretty nasty (more there than above).. and, i cursed palm so much at the time; but, persistance paid off *g* also, pre os3.5 = had to do this little hack in another way :) oh so much fun that was to figure out - had to redefine the good old GDeviceType :) the code is still there, and, runs like a gem.. --- Aaron Ardiri [EMAIL PROTECTED] CEO - CTO +46 70 656 1143 Mobile Wizardry http://www.mobilewizardry.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
