Giter Site home page Giter Site logo

Comments (2)

priitj avatar priitj commented on September 23, 2024

Hi,

Short answer: it's possible, but expensive to calculate.

You can think of whitedb memory allocation as working on two levels. There are bigger chunks that hold one type of objects, such as integers and strings. When one chunk gets filled, another of the same type is allocated. This "chunk level" memory is cheap to keep track of and this is what the wg_database_freesize() reports. However, it is not necessary to free those chunks and the side effect is that the size reported by that function never decreases.

The objects inside the chunks are freed and the memory does get reused. But the information about the free objects is stored in a way that makes it expensive to add up all the available space.

If you're curious then you can look at the function wg_show_db_area_header() and the functions that it calls in Test/dbtest.c

For practical purposes the best way would be to implement bookkeeping inside the whitedb library. There are a limited number of functions that create and free objects in Db/dballoc.c.

from whitedb.

vividsnow avatar vividsnow commented on September 23, 2024

ok, thanks

from whitedb.

Related Issues (20)

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.