<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I found the leaks and they were in SwordReader's search code. There was
a call to VerseKey::clone which returns a pointer to a SWKey, which was
then being implicitly cast back into a VerseKey object, and the
anonymous object was lost in the transaction. This also cleared the
stdstr leak as well which I assume had to do with the lost SWKey. <br>
<br>
Also I have implemented a better progress bar in SwordReader's search,
it actually updates by passing SWModule::search's call back argument.
It now updates regularly.<br>
<br>
--<br>
In Christ,<br>
David Trotz<br>
<br>
David Trotz wrote:
<blockquote cite="mid:47DDEFCA.3080409@crosswire.org" type="cite">
<div class="moz-text-flowed"
style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">I
have spent the weekend restructuring some of the SwordReader code.
<br>
<br>
I removed the UString stuff and implemented a more elegant replacement
called WCString. WCString can convert (typically implicitly) from const
char*, const wchar_t *, and std::string. This will make string
manipulations between the sword api and the wince api much easier to
deal with as well as read.
<br>
<br>
I ran "Code Snitch" (a memory and resource leak detection software)
against the current source code and eliminated all known memory and
resource leaks in the gui. I did spot a couple of minor memory leaks in
the sword api. I cannot verify for sure that they are in fact memory
leaks but I can say thus far when code snitch detects a memory leak it
has yet to be wrong, even when I was sure it was wrong. I will try to
take a stab at fixing these later this week but if anyone recognizes
these and has an "oh yeah, I forgot about that..." moment feel free to
take these on. Of course these might be memory leaks in the context of
my gui source code, but I will point them out anyway.
<br>
<br>
<tt><utilstr.cpp>
<br>
char *stdstr(char **ipstr, const char *istr, unsigned int memPadFactor)
{
<br>
if (istr) {
<br>
if (*ipstr)
<br>
delete [] *ipstr;
<br>
int len = strlen(istr) + 1;
<br>
// the following line has been tagged as a memory leak
<br>
*ipstr = new char [ len * memPadFactor ];
<br>
memcpy(*ipstr, istr, len);
<br>
}
<br>
return *ipstr;
<br>
}
<br>
</utilstr.cpp>
<br>
<br>
<versekey.cpp>
<br>
SWKey *VerseKey::clone() const
<br>
{
<br>
// the following line has been tagged as a memory leak
<br>
// probably someone forgot clone creates a new object
<br>
// on the heap
<br>
return new VerseKey(*this);
<br>
}
<br>
</versekey.cpp>
</tt><br>
<br>
After spending the time I have in the SwordReader internals, I am
making plans to restructure more of the source code to make it a bit
more intuitive and approachable. Once this is done I will introduce my
new html renderer.
<br>
<br>
Thanks everyone for your prayers and encouragement. They have paid off.
<br>
In Christ,
<br>
David Trotz
<br>
<br>
<br>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
</body>
</html>