Hi there,

Thanks for your comments, and I am passing NULL now to the busy handler......;-)

I also say on the SQLite site that the pragma " default_cache_size "  should 
not be used anymore 
(http://www.sqlite.org/pragma.html#pragma_default_cache_size )
("Do not use this pragma! This pragma is deprecated and exists for backwards 
compatibility only.")

Let me make some of the changes and see what MemoryScape says as well...I will 
let you know....

Thanks

Lynton



-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Stephan Beal
Sent: Tuesday, September 06, 2011 2:38 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] MemoryScape saying I have LEAKS in my SQLite code?

On Tue, Sep 6, 2011 at 2:28 PM, Grice, Lynton (L) <lynton.gr...@sasol.com>wrote:

> May I ask what you suggest with the way I am using the 
> sqlite3_busy_handler? What is the "normal approach"? I have tried to 
> look at examples etc
>

Hi!

i don't use the busy handler, so i can't say, but i do know that it is NEVER 
valid to use a free()d pointer, and that's essentially what you've done here. 
If you don't want to pass any data to the busy handler then pass NULL as the 
final argument instead of a value which will be free()d immediately afterward 
sqlite3_busy_handler().


> p = sqlite3_malloc(256);
> sqlite3_busy_handler(handle, &eventLoggerBusyHandler, p); 
> sqlite3_free(p);
>
> Also, you mentioned the following "should fail"


> sqlite3_exec(handle,"PRAGMA default_cache_size = 50;",0,0,0);
>

i didn't say it should/would, i implied that it _could_ by asking if you are 
_sure_ that it won't fail. If that fails, it might be useless to continue with 
the other queries, but the return code is not checked here.

Even "cannot fail" commands with perfect SQL syntax and well-defined semantics 
can fail because of external problems. e.g. out-of-memory or i/o error. Once 
you get one of these errors, it's generally not a good idea to continue using 
the db handle (i would argue, though there are those who could rightly argue 
otherwise).

--
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
----------------------------------------------------------------------------
NOTICE: Please note that this eMail, and the contents thereof, 
is subject to the standard Sasol eMail legal notice which may be found at: 
http://www.sasol.com/legalnotices                                               
                                                           

If you cannot access the legal notice through the URL attached and you wish 
to receive a copy thereof please send an eMail to 
legalnot...@sasol.com
----------------------------------------------------------------------------
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to