tdlib / td

Cross-platform library for building Telegram clients

Home Page:https://core.telegram.org/tdlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

db.sqlite keeps growing forever.. up to 18 Gig!

jpage4500 opened this issue · comments

This isn't a new issue AFAIK -- I commented on this one a while back: #62

I wrote a test Android app using TDLIB which isn't much more than a simple Telegram client. I had kind of forgotten about it until my test device was running low on space and found out this was the culprit.

sargo:/data/data/com.test.app/files/telegram # ls -al
...
-rw-------  1 u0_a235 u0_a235 18727751680 2024-05-21 10:42 db.sqlite
-rw-------  1 u0_a235 u0_a235      229376 2024-05-21 10:42 db.sqlite-shm
-rw-------  1 u0_a235 u0_a235  2529132072 2024-05-21 10:42 db.sqlite-wal
...

Is there some way to clean this periodically? I imagine it's just accumulating every message for every channel I'm subscribed to and never removing them. I don't see a TDLIB function to do this. I do see OptimizeStorage but that appears to be for the attachments it's downloading and not related to the database

If you don't have secret chats, and don't store important data in chat.client_data, then you can just delete the db.sqlite file when the TDLib instance is closed.

You can also disable all databases in setTdlibParameters, in which case the database will be deleted and wouldn't be used anymore.