Hi everyone,

A couple of months ago I started writing a Microsoft .NET
(1.1 at the moment, but it will be 2.0) wrapper around SQLite.
I know a couple of those already exist, but for various
reasons these do not meet my requirements.

Everything is looking fine except for managing memory. I've
had some memory problems according to some profilers
which I've seem to have fixed but I want to make sure. I
have looked at the everything in the site but with certain
(SQLite) functions it is unclear to me who is responsible
to clean up any allocated memory.

Now I seem to remember from long long ago that there
where some "rules" in C(++) who is responsible in which case
with a library or DLL, but I have no idea if that is true or what
those rules would be.

The first sign of trouble began with the sqlite3_errmsg(16)
function. I had MS .NET release that memory which seemed
a bad thing to do. After I stopped doing that, and I assume
SQLite frees it, everything appears fine.

That let me to wonder about the following functions:

- sqlite3_column_blob/text(16)

With these functions I copy out the data and (hopefully) let
SQLite free the memory.

- sqlite3_libversion

I let the MS .NET framework free this memory.

At the moment this is inconsistent as you can see. Is any of
this correct or?

Since sqlite3_bind_blob/text(16) let me select either transient
or static I'm always responsible for that memory, right?

Any clarification on this matter will be greatly appreciated.

Thanks!

Best,

Rob Lohman

Reply via email to