On Sat, 14 Aug 2004 13:10:13 -0000, Merav Rubinstein
<[EMAIL PROTECTED]> wrote:
> I read that, but the article in "highway1" is not available...
Well, I have no control over that - at the time I linked to the
article it was available. Anyway, my contribution was really 'my way"
part of the article. I only linked to other articles to show that
there are other, albeit inferior, approaches.
> my code is:
>
> in the handle event, open form:
>
> for(i = 0; i < 50; i++)
> {
> statuslist[i]=MemPtrNew(sizeof(Char)*STATUS_LENGH);
> StrCopy(statuslist[i],"");
> }
>
> handle event, close form:
>
> for(i = 0; i < MAX_LEN; i++)
> {
> if(statuslist[i])
> {
> MemPtrFree(statuslist[i]);
> statuslist[i] = NULL;
> }
> }
One "for" loop uses constant 50, the other MAX_LEN. If they're the
same, for the sake of clarity you should use MAX_LEN (or
STATUS_LIST_ELEMENT_COUNT) in both cases. If they're not, you have a
problem.
> I use those strings all the time and when I use the debugger I can see that the
> MemPtrFree causes the problem , usually when i=40, and sometime it works. Any one
> has idea?
When you say "MemPtrFree" causes the problem, what exactly do you
mean? I don't think you can tell in the debugger that a given
MemPtrFree() leaks memory.
Krzysztof Kowalczyk | http://blog.kowalczyk.info
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/