drizzle-team / drizzle-team/drizzle-orm

[BUG]: Memory leaks with sqlite in react native

Open
#4,068 6 comments 2 reactions 0 assignees View on GitHub
bug driver/expo-sqlite priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.39.1

### What version of `drizzle-kit` are you using?

0.30.4

### Other packages

expo-sqlite@14.0.6

### Describe the Bug

**The problem:**
I noticed that when using Drizzle ORM in a React Native app, the "native" memory usage in the Android Studio profiler keeps increasing. For example, in my application, I update a single database record every 300ms.

I need to create a React Native application that runs 24/7 on an Android tablet. In my test, after 10 minutes, the "native" memory usage increased by 25MB. Since the application continuously updates data, after one or two days, it consumes all available memory and crashes, which I want to avoid.

![Image](https://github.com/user-attachments/assets/1d36a405-2ed8-4645-b405-df8dc9781e08)
![Image](https://github.com/user-attachments/assets/2ffe5095-5d6c-4ab5-831a-667f3661388f)

**How to reproduce?**
I have created a repository where you can reproduce the issue: [https://github.com/kmichaliq/react-native-memory-usage](https://github.com/kmichaliq/react-native-memory-usage)

After clone repo, install dependencies and run app.

Next, click "Insert new device" few times to add rows to the "devices" table in db.
Then click "Start Loop [UPDATE]" and view the results in Android Studio Profiler.

![Image](https://github.com/user-attachments/assets/3dcd9493-c6e2-4d58-9412-630836034a22)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.