rdp / google_hash

wrapper for google's hash functions, for ruby
BSD 3-Clause "New" or "Revised" License
92 stars 16 forks source link

How to free memory #42

Open antiloopgmbh opened 7 years ago

antiloopgmbh commented 7 years ago

Hi,

i am allocating some quite big hashes inside a sidekiq process with

buffer = GoogleHashDenseRubyToRuby.new

and i wonder how i can free up that memory after being done processing that hash. Obiously setting buffer to nil doesn't help much :)

As for the moment, i just restart sidekiq but i really want to do it right.

Thanks, Gerold

rdp commented 7 years ago

is there a clear method?

On Fri, Mar 3, 2017 at 7:53 AM, Gerold Böhler notifications@github.com wrote:

Hi,

i am allocating some quite big hashes inside a sidekiq process with

buffer = GoogleHashDenseRubyToRuby.new

and i wonder how i can free up that memory after being done processing that hash. Obiously setting buffer to nil doesn't help much :)

As for the moment, i just restart sidekiq but i really want to do it right.

Thanks, Gerold

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rdp/google_hash/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAw0FN01jJV7Nv6FR9c3m6ZlJYRm3Biks5riClRgaJpZM4MSWRo .

antiloopgmbh commented 7 years ago

There is - i will give it a try tonight

antiloopgmbh commented 7 years ago

I tried calling .clear but i still need to restart the ruby process to free the memory. Any more hints?

rdp commented 7 years ago

If you can avoid using RubyToRuby and use something else (IntToWhatever) that helps. Besides that calling GC.start might help. But also realize that ruby allocates memory in big blocks (IIRC) and can't deallocate it until all points to that block are freed, which basically never happens. Good luck!

On Mon, Mar 27, 2017 at 1:44 AM, Gerold Böhler notifications@github.com wrote:

I tried calling .clear but i still need to restart the ruby process to free the memory. Any more hints?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rdp/google_hash/issues/42#issuecomment-289377911, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAw0CPAryOSxTh3G040KBAuAYNfA29Hks5rp2jngaJpZM4MSWRo .