Hi there, I have a two-part question relating to an "out of memory" error on the Zire m150.
First of all, I've seen talk about a Zire emulator that's available through the Palm SG Developer Program. I've signed up and found simulators for the Z71, Tungsten T & Tungsten C, and an emulator for the Tungsten W. As I understand it, it is also not possible to debug directly on a Zire device using CW9? As for the bug... I'm only encountering it on base Zire units, quite early in a "stress test" session. My software runs fine on every other device I've used, and we have thousands of clients successfully using devices from OS3.01 to OS5.0. I've run the same test routine on a number of different emulator & simulator sessions, with both debug and release ROMs, and I monitor the memory using a "HeapList 0" command in CW9's Debug Console. In every case on release ROMs, and in most cases on debug ROMs, I do not lose any memory while stress testing the app. Using the debug OS4.01 ROM I do lose memory over time. Though it's set to check for memory leaks, it doesn't indicate anything in my log. I'm losing my marbles trying to test this on a Zire, and trying to figure out why I lose memory on a 4.01 debug ROM with 8MB of RAM while I don't lose any on an m100 (OS3.5) debug ROM with 2MB of RAM. Question 1: are there any suggestions re: debugging for the Zire? Question 2: any idea what could be causing my memory leak on a 4.01 debug ROM? I only dynamically allocate memory in a few areas, and I can't see anything obvious. The one area I am worried about is a String class I've created. The relevant components of the code (minus error handling) are: * String class consists of: Int16 Siz; // allocated size Int16 Len; // current length Char * Txt; // pointer to text * I allocate the memory as follows (called by copy constructor and '=' methods): void String::SetTxt(const Char *newText) { Len = StrLen(newText); Siz = (Len+1) * sizeof(WChar); // allow room for NULL MemHandle h = MemHandleNew(Siz); Txt = (Char *)MemHandleLock(h); StrNCopy(Txt, newText, Len); Txt[Len] = '\0'; // doesn't lock the handle here. does it need to? } * I free the memory as follows (Free is called by the '=' method, which then calls SetTxt to allocate the new memory, and by the destructor) void String::Free() { Siz = 0; Len = 0; if (Txt == NULL) return; MemPtrFree(Txt); // replaces the need to recover, unlock and free MemHandle Txt = NULL; } * There are no global or static strings in my app. Although I lock the handle and leave it locked so the string ptr can be used by the calling function, I am assuming that the destructor's call of "Free" will take care of cleanup. * I've tracked down which functions seem to be losing memory on the 4.01 debug ROM, but I'm struggling with the exact cause since there are a number of implicit string class calls (especially for construction and destruction). I am somewhat concerned that when strings are implicitly being called as function parameters (e.g. "f(Str1 + Str2 + Str3)"), they may not be properly disposed of. I hope this makes sense, and any feedback would be greatly appreciated. -Mark Cameron Techneos Systems Inc. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/