Do you have to drop the index? Why not just keep it around, its obviously 
useful if you need to create it in the first place right?
   
  
Dave Gierok <[EMAIL PROTECTED]> wrote:
  It does in fact look like the memory isn't being freed up entirely. I am 
properly tracking xMalloc, xRealloc, and xFree. I have a memory database and 
wrote some test code to loop a few times creating/dropping the same index. The 
results of that are (numbers are total bytes allocated):

7632746 Before 1st Create Index
7637587 After 1st Create Index
7637434 After 1st Drop Index (and Vacuum -- the vacuum doesn't change memory 
allocated though)
7637587 After 2nd Create Index
7637434 After 2nd Drop Index (and Vacuum)
7637587 After 3rd Create Index
7637434 After 3rd Drop Index (and Vacuum)

Notice that the memory slightly decreases after the 1st Drop Index, but doesn't 
nearly drop to what it should (it should drop to 7632746 -- the same level as 
before the 1st Create Index).

Also notice that after the 1st create/drop, the memory allocated is the same 
after each create and after each drop. So it implies there is not a leak -- but 
we can't get down to the original level before we created the first index.

So what's the big deal you might ask -- this example shows 5K that can't be 
reclaimed. But in our game we create hundreds of indices that take up about 2MB 
-- 2MB is quite a bit of memory in our world.

Any suggestions or explanations?

Thanks,
Dave

-----Original Message-----
From: Dave Gierok [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 17, 2007 9:06 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] DROP INDEX not freeing up memory

OK, thanks, I'll do some more digging and let you know.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 17, 2007 8:30 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] DROP INDEX not freeing up memory

Dave Gierok wrote:
> xTruncate is not being called because this is an in-memory database. Memor=
> y databases should have memory freed instead I assume?
>

In-memory databases call sqliteFree() to release their memory.
I checked, and this does appear to work. Perhaps the sqliteFree()
call is somehow not making it down into your measurement layer.

--
D. Richard Hipp 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to