Search code examples
c#sqlitexamarinxamarin.androidsqlite.net

Xamarin - Sqlite.net memory consumption is very high


I am working on Xamarin.Android application. In this application, I have local database. I am using sqlite.net plugin to manage sqlite operations.

While testing application on lower configuration, I found have memory consumption from application. while checking with Xamarin Profiler, I got to know that majority memory is allocated to one of database method [more than 50 %].

It is used in System.Linq.Enumerable:FirstofDefault<SQlite.TableMapping/Column>.

Can we manually deallocate this memory? is there any way? Can we release memory from application progrmattically?

I have tried with GC.Collect() but it is not useful.

If anyone have idea actual reason behind this issue?


Solution

  • After doing some research, i found that we can use PRAGMAfunction to release memory.

    We can call below query to release memory manually.

    PRAGMA shrink_memory;