goccy / bigquery-emulator

BigQuery emulator server implemented in Go
MIT License
840 stars 107 forks source link

BQ-Emulator does not release memory when deleting tables #313

Open j-antunes opened 6 months ago

j-antunes commented 6 months ago

What happened?

I am using BQ-Emulator as part of my unit test suite. A lot of the unit tests create a lot of tables, so my RAM usage goes up. To try and reduce the amount of memory needed. I want to delete the table created in that unit test, after the test is completed. I implemented a teardown step to delete the table a the end of my test.

To my surprise if I try to delete the tables the memory usage goes up.

Image of memory usage after running my tests, and all tables are created: image

Image of memory usage after delete all tables. Note that usage is now 4.817GB image

I would appreciate any help!

What did you expect to happen?

When deleting the tables, I would expect to be able to recoup the memory usage.

How can we reproduce it (as minimally and precisely as possible)?

run docker stats to see memory usage Create any table in BQ Delete any table in BQ

Observe that memory usage goes up.

Anything else we need to know?

Doing a docker restart recoups all memory.