0

We are trying to Integrate SQLite in our Application and are trying to populate as a Cache. We are planning to use it as a In Memory Database. Using it for the first time. Our Application is C++ based.

Our Application interacts with the Master Database to fetch data and performs numerous operations. These Operations are generally concerned with one Table which is quite huge in size. We replicated this Table in SQLite and following are the observations:

Number of Fields: 60 Number of Records: 1,00,000

As the data population starts, the memory of the Application, shoots up drastically to ~1.4 GB from 120MB. At this time our application is in idle state and not doing any major operations. But normally, once the Operations start, the Memory Utilization shoots up. Now with SQLite as in Memory DB and this high memory usage, we don’t think we will be able to support these many records.

When I create the DB on Disk, the DB size sums to ~40MB. But still the Memory Usage of the Application remains very high.

Q. Is there a reason for this high usage. All buffers have been cleared and as said before the DB is not in memory?

Any help would be deeply appreciated.

Thanks and Regards Sachin

3
  • 60 fields sounds like a spreadsheet. Look at your data to see if normalising could save you a buttload of space. Commented Nov 8, 2010 at 11:35
  • sounds like you have a memory leak Commented Nov 8, 2010 at 20:46
  • Where do you suspect the leak is? in SQLite or our Application? In my Application, the structures and buffers are getting cleaned up properly. Commented Nov 10, 2010 at 4:26

2 Answers 2

2

You can use the vacuum command to free up memory by reducing the size of sqlite database.

If you are doing a lot of insert update operations then the db size may increase. You can use vaccum command to free up space.

Sign up to request clarification or add additional context in comments.

Comments

1

SQLite uses memory for things other than the data itself. It holds not only the data, but also the connections, prepared statements, query cache, query results, etc. You can read more on SQLite Memory Allocation and tweak it. Make sure you are properly destroying your objects too (sqlite3_finalize(), etc.).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.