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

Cyclic initialization & deinitilization of persistent.Map cause memory leak #356

Open
hicolour opened this issue Jan 4, 2022 · 1 comment
Labels
bug Something isn't working production release Tasks required for production release

Comments

@hicolour
Copy link

hicolour commented Jan 4, 2022

In a single application life cycle I have a need to use multiple times fresh instance of persistence map to reduce pressure on memory.

    val map = {
      persistent.Map[String, Int, Nothing, Glass](File.newTemporaryDirectory("suggestions_topn_").deleteOnExit().path)
    }

when the business operation is completed ( multiple map.put and one map.values.foreach ) persistent map is being closed using

map.close()

After multiple cycles memory is being occupied by swaydb.core.level.zero.LevelZeroMapCache that have root reference in scala.sys.ShutdownHookThread

image

image

It is not clear from docs is something else e.g. map.delete should be called to clear references.

@simerplaha simerplaha added bug Something isn't working production release Tasks required for production release labels Jan 4, 2022
@simerplaha
Copy link
Owner

simerplaha commented Jan 4, 2022

Calling map.close() should be enough. delete() simply calls close and then deletes all persisted file.

This sounds like a bug with the shutdown hook.

Thank you for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working production release Tasks required for production release
Projects
None yet
Development

No branches or pull requests

2 participants