Coder Social home page Coder Social logo

memrecycle's Introduction

memrecycle ♻

Why waste memory when you can recycle it?

All of the initial code and concepts were taken from this article on CloudFlare's blog: http://blog.cloudflare.com/recycling-memory-buffers-in-go

The basic idea is that garbage collected languages like Go tend to over-request memory and become wasteful in certain scenarios (great graphs are provided in the article linked above that visualize this fact). This method introduces a way of recycling memory that yields truly staggering results by using goroutines and channels. The best example of this is when running the garbage_creator.go program for 10 minutes there are roughly 600 buffers created, 375,000,000 bytes requested, and only 150,000,000 bytes truly needed. So the program requested roughly 2.5x the amount of memory it actually needed. Additionally, there is an incredible amount of memory being used that is just idling waiting to be taken care of by the garbage collector. When running the improved mem_manage.go program for 10 minutes there are roughly 21 buffers created, 160,000,000 bytes requested, and only 150,000,000 bytes truly needed. This is almost a 1:1 ratio between what is required and what is requested - a drastic improvement. There is also close to 0 idling memory.

memrecycle's People

Watchers

Houlihan O'Rogerson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.