Search code examples
memorykdb

Determine memory consumption of each variable/table in kdb process


I have a shared kdb process on my server that many people use at the same time, it is not possible to easily know the actions of each person and sometimes the memory gets filled up quite easily. I'm intending to start clearing stale variables starting from the largest to the smallest in footprint to reduce impact on users.

Is there straight-forward way to get a list of variables and tables with their respective size in memory? .Q.w[] only shows consumption for the process.

Thanks


Solution

  • There are some great summarization routines found the ws namespace in GitHub.

    These routines list the names of objects of particular classes (functions, variables, or tables), or provide a type- dependent synopsis of their properties. Names can be specified either explicitly or by referencing a parent namespace (in which case all objects in all namespaces below it are considered). Object size is approximated and does not include attribute overhead.

    https://github.com/LeslieGoldsmith/ws