Skip to content
/ mall Public

access the mallinfo(3) and mallopt(3) functions from Ruby

License

Unknown, LGPL-3.0 licenses found

Licenses found

Unknown
LICENSE
LGPL-3.0
COPYING
Notifications You must be signed in to change notification settings

sitano/mall

Repository files navigation

= Mall - access malloc tuning/reporting functions + glibc extras

This library provides access to the SysV mallinfo(3) and mallopt(3)
functions as well as (optionally) several glibc-specific malloc_*()
functions.  Mall.opt, Mall.trim and Mall.xml are the most interesting.

Constants and functionality are defined at build time, so changing
your malloc implementation may require rebuilding and reinstalling
this library.

== Quick Start

  > require 'mall'

  > irb(main):007:0> Mall::info

  => {:arena=>12099584, :ordblks=>139, :smblks=>30, :hblks=>3, :hblkhd=>1650688, :usmblks=>0, :fsmblks=>1536, :uordblks=>12068400, :fordblks=>31184, :keepcost=>3616}

Where:

  struct mallinfo2 {
    size_t arena;     /* Non-mmapped space allocated (bytes) */
    size_t ordblks;   /* Number of free chunks */
    size_t smblks;    /* Number of free fastbin blocks */
    size_t hblks;     /* Number of mmapped regions */
    size_t hblkhd;    /* Space allocated in mmapped regions (bytes) */
    size_t usmblks;   /* See below */
    size_t fsmblks;   /* Space in freed fastbin blocks (bytes) */
    size_t uordblks;  /* Total allocated space (bytes) */
    size_t fordblks;  /* Total free space (bytes) */
    size_t keepcost;  /* Top-most, releasable space (bytes) */
  };

See `man 3 mallinfo2` (https://man7.org/linux/man-pages/man3/mallinfo.3.html).

  irb(main):008:0> Mall::dump_stats

  Arena 0:
  system bytes     =   12099584
  in use bytes     =   12065808
  Total (incl. mmap):
  system bytes     =   13750272
  in use bytes     =   13716496
  max mmap regions =          4
  max mmap bytes   =    1851392

  => nil

== Requirements

* A malloc implementation supporting mallinfo(3) and/or mallopt(3),
  the ptmalloc-family of allocators used by glibc is recommended
  and the only tested implementation.

== Build

  gem install rake-compiler
  rake build

== Install

  git clone https://github.com/sitano/mall.git && cd mall && git co ivan
  gem build mall.gemspec
  gem install mall-1.0.2.gem

or add

  gem 'mall', git: 'https://github.com/sitano/mall.git', branch: 'ivan'

and then:

  $ bundle install

== SOURCE:

The original source code is available via git:

  git://yhbt.net/mall.git
  http://yhbt.net/mall.git

cgit repository viewer:

* http://yhbt.net/mall.git (cgit)

== Contact

All feedback (bug reports, user/development dicussion, patches, pull
requests) go to the mailing list: {mall@librelist.org}[mail@librelist.org]

About

access the mallinfo(3) and mallopt(3) functions from Ruby

Resources

License

Unknown, LGPL-3.0 licenses found

Licenses found

Unknown
LICENSE
LGPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published