在房间数据库中保存数据的存储限制是多少?

What is the storage limit of saving data in room database?

我有一个带有房间数据库的应用程序。我如何知道已达到数据存储的最大限制? 如果应用程序超过该限制会发生什么。它会影响已经存储的数据还是只是停止添加新数据?

来自docs

The Room persistence library provides an abstraction layer over SQLite

所以我假设房间的限制与SQLite相同。

来自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).

我怀疑你会达到这个限制,我相信你可以填满设备上的所有可用内存。

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

查看this answer,很详细

What happens if the app exceeds that limit

我真的认为这取决于您执行的操作,但是为了避免崩溃,您可以像链接的答案中那样事先检查内存来处理它。