boltdb / bolt

An embedded key/value database for Go.
MIT License
14.21k stars 1.51k forks source link

Best way to limit memory usage? #692

Open ghost opened 7 years ago

ghost commented 7 years ago

Is there a good way to set a hard limit on the memory usage of bolt? Going to be using it embedded on a user-spacey application and can't allow it to eat up all resources if a large record comes along...

juliandroid commented 7 years ago

I was looking at the same problem and it seems that you have to modify bolt_platform.go (for example bolt_arm.go) and modify maxMapSize to the maximum size you want. There is no option to change, only options.InitialMmapSize which is nice, but not the same :)

ghost commented 7 years ago

Dang. Maybe something I can add config control for and pr soon. Thx anyways