Another little note:
 
> This together with the strange coincidence that the problem only occurs when 
> I update 2 tables 
> in the same transaction has led me to suspect that sqlite3_prepare() might 
> have a problem(?)  
 
The problem always occur when I run the UPDATE on the 2. table. For each call 
to my function I update 5 records in 1 table without any problem - but if 
sqlite 'chooses' to fail it _always_ fails when I update the first record of 
the 2. table. 
 
 
/Michael

________________________________

From: Michael B. Hansen [mailto:[EMAIL PROTECTED]
Sent: Fri 2006-05-26 19:07
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Possible bug in sqlite3_prepare



Hi Joel,

I too have suspected Finisar.SQLite wrapper - and yes I have updated the SQLite 
library to a newer version than the one Finisar.SQLite ships with.

However, I have dug pretty deep into the code by now - and I cannot see 
anything wrong with it. You write yourself that it might be the result of the 
garbage collector - and I too have suspected this. It also does make sense with 
my tests - that the only way I can reproduce the error in a somewhat consistant 
way is by using SciTech Memory Profiler which does a complete garbage 
collection when doing a heap collection to find memory leaks. However, 1) the 
problem does not occur directly after doing a heap collection but say 200-500 
calls after and 2) by analysing the Finisar.SQLite wrapper no object looks 
elligable for garbage collection in regards to calls to the SQLite. Finally 3) 
the problem originates from SQLite and not my code or Finisar.SQLite. I have 
verified that I send valid pointers to sqlite3_prepare() but it fails anyway.

This together with the strange coincidence that the problem only occurs when I 
update 2 tables in the same transaction has led me to suspect that 
sqlite3_prepare() might have a problem(?) Another possible cause could be the 
.NET interorb that does the actual call to the DLL - but I use the same 
techniques to call another unmanaged DLL without any problems.

Please note, I'm not happy with writing to this list regarding the problem 
because of the excellent quality SQLite has - but I have tried EVERYTHING by 
now, and all points to the call to sqlite3_prepare()

I have just today in another post here on the list seen a post regarding the 
Mono version of SQLite. Does anybody know if this is compliant with the MS .NET 
framework 1.1?


Best regards,

Michael Hansen



________________________________

From: Joel Lucsy [mailto:[EMAIL PROTECTED]
Sent: Fri 2006-05-26 17:37
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Possible bug in sqlite3_prepare



On 5/26/06, Michael B. Hansen <[EMAIL PROTECTED]> wrote:
>
> This all works very well for some time - then suddenly after 250 - 10000
> calls to my function sqlite3_prepare returns "Object reference not set
> to an instance of an object" - which is a .NET exception I interpretate
> as a Null-pointer-exception / malloc failure.


I can't speak to your specific issue, but I've written a .NET wrapper for a
C++ project and that error is more than likely the result of the garbage
collector collecting a reference that the .NET assembly assumes is
still there. I can't tell you how many times this has happened to me.
Particularly, delegates can be tricky. If you don't put all your delegates
into some container like and ArrayList, eventually the GC comes along
and deletes your delegates. Then, poof, your application blows up
because the delegate you were using as a callback is gone. I heavily
suspect that the Finisar.SQLite wrapper is the issue, not your code.

--
Joel Lucsy
"The dinosaurs became extinct because they didn't have a space program." --
Larry Niven




Reply via email to