Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete never release memory #309

Open
Kyan820815 opened this issue Mar 16, 2022 · 1 comment
Open

Delete never release memory #309

Kyan820815 opened this issue Mar 16, 2022 · 1 comment
Labels

Comments

@Kyan820815
Copy link

What is the issue you are having?
We add data into bigcache, and using delete, but seems like it only set byte array with 0.

For example, in one big cache there are 111111111111 of a byte queue, and we use delete, it only make it to 111000111111
so next time we insert new data, it still add to the back of byte queue, rather than use those three bytes with 0.

Is there anyway to delete byte correctly so that the queue size would not grow or reuse 0 byte correctly?

For more information on how to provide an MCVE, please see the Stack Overflow documentation.

Environment:

  • OS (e.g. from /etc/os-release or winver.exe): macosx
  • go version: go1.16.8
@Kyan820815 Kyan820815 added the bug label Mar 16, 2022
@janisz
Copy link
Collaborator

janisz commented Mar 18, 2022

This is working as expected and was one of the design choices we made to keep it simple. When you remove element it's not removed but marked as removed. When space is running out we overwrite removed elements. By doing this we don't have a problem with fragmentation and garbage collection. Without this assumption we will end up implementing our own GC which is probably bad idea as Go already has on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants