4

I have an app with the room database. How would I know that the maximum limit of data storage is reached? What happens if the app exceeds that limit. Does it affect the already stored data or just stops adding the new data?

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
Sweta Jain
  • 3,248
  • 6
  • 30
  • 50

1 Answers1

6

From docs

The Room persistence library provides an abstraction layer over SQLite

So I would assume that room has the same limit as SQLite.

From Limits In SQLite

Maximum Database Size

Every database consists of one or more "pages". Within a single database, every page is the same size, but different database can have page sizes that are powers of two between 512 and 65536, inclusive. The maximum size of a database file is 4294967294 pages. At the maximum page size of 65536 bytes, this translates into a maximum database size of approximately 1.4e+14 bytes (281 terabytes, or 256 tebibytes, or 281474 gigabytes or 256,000 gibibytes).

I doubt you will hit this limit, rather I believe you can fill all available memory on the device.

How would I know that the maximum limit of data storage is reached?

Check this answer, is very detailed

What happens if the app exceeds that limit

I really think this depends on the operation you do, but to avoid crashes you can handle it by previously checking the memory like in the linked answer.

Stefano Sansone
  • 2,377
  • 7
  • 20
  • 39