mall 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +6 -0
- data/.gitignore +13 -0
- data/.olddoc.yml +4 -0
- data/COPYING +165 -0
- data/GIT-VERSION-GEN +40 -0
- data/GNUmakefile +12 -0
- data/Gemfile +6 -0
- data/LICENSE +18 -0
- data/README +88 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/mall/.gitignore +5 -0
- data/ext/mall/extconf.rb +12 -0
- data/ext/mall/mall.c +301 -0
- data/ext/mall/mall.c.erb +246 -0
- data/mall.gemspec +21 -0
- data/pkg.mk +150 -0
- data/setup.rb +1585 -0
- data/test/test_mall.rb +66 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7cc4bea6435e32ac022043ee50e6184b747c3670
|
4
|
+
data.tar.gz: cc1a7085b64f0d8c35e5875f6d6badc8295f9ec2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 575adf8e3acfdcd9e20de81a77fbc90f2246273243f585c2f2ae74673b6094c42dd08afc3becc161f07405dbfe9c4705f2f7211430b4d36869f9b577a083b133
|
7
|
+
data.tar.gz: bf9e2e3cc2d655360e0f5964f8805b0141c18f858f9343ad6da79e0e3af8a997214fe53daaf8ed1256efd5307754fc8aeff239a100bf78ac9d7147279ed28e95
|
data/.document
ADDED
data/.gitignore
ADDED
data/.olddoc.yml
ADDED
data/COPYING
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/GIT-VERSION-GEN
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
GVF=GIT-VERSION-FILE
|
4
|
+
DEF_VER=v1.0.2.GIT
|
5
|
+
|
6
|
+
LF='
|
7
|
+
'
|
8
|
+
|
9
|
+
# First see if there is a version file (included in release tarballs),
|
10
|
+
# then try git-describe, then default.
|
11
|
+
if test -f version
|
12
|
+
then
|
13
|
+
VN=$(cat version) || VN="$DEF_VER"
|
14
|
+
elif test -d .git -o -f .git &&
|
15
|
+
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
16
|
+
case "$VN" in
|
17
|
+
*$LF*) (exit 1) ;;
|
18
|
+
v[0-9]*)
|
19
|
+
git update-index -q --refresh
|
20
|
+
test -z "$(git diff-index --name-only HEAD --)" ||
|
21
|
+
VN="$VN-dirty" ;;
|
22
|
+
esac
|
23
|
+
then
|
24
|
+
VN=$(echo "$VN" | sed -e 's/-/./g');
|
25
|
+
else
|
26
|
+
VN="$DEF_VER"
|
27
|
+
fi
|
28
|
+
|
29
|
+
VN=$(expr "$VN" : v*'\(.*\)')
|
30
|
+
|
31
|
+
if test -r $GVF
|
32
|
+
then
|
33
|
+
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
|
34
|
+
else
|
35
|
+
VC=unset
|
36
|
+
fi
|
37
|
+
test "$VN" = "$VC" || {
|
38
|
+
echo >&2 "GIT_VERSION = $VN"
|
39
|
+
echo "GIT_VERSION = $VN" >$GVF
|
40
|
+
}
|
data/GNUmakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
all::
|
2
|
+
RSYNC_DEST := yhbt.net:/srv/yhbt/mall
|
3
|
+
mall_c := ext/mall/mall.c
|
4
|
+
pkg_extra += $(mall_c)
|
5
|
+
$(mall_c): $(mall_c).erb
|
6
|
+
erb < $< > $@+
|
7
|
+
mv $@+ $@
|
8
|
+
rfpackage := mall
|
9
|
+
doc:: $(mall_c)
|
10
|
+
include pkg.mk
|
11
|
+
$(ext_pfx)/$(ext)/mall.c: $(mall_c)
|
12
|
+
$(ext_pfx)/$(ext)/Makefile: $(ext_pfx)/$(ext)/mall.c
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
mall is copyrighted Free Software by all contributors, see logs in
|
2
|
+
revision control for names and email addresses of all of them.
|
3
|
+
|
4
|
+
You can redistribute it and/or modify it under the terms of the GNU
|
5
|
+
Lesser General Public License (LGPL) as published by the Free Software
|
6
|
+
Foundation, version {2.1}[http://www.gnu.org/licenses/lgpl-2.1.txt] or
|
7
|
+
or {3}[http://www.gnu.org/licenses/lgpl-3.0.txt] (see link:COPYING).
|
8
|
+
The mall project leader (Eric Wong) reserves the right to
|
9
|
+
relicense mall under future versions of the LGPL.
|
10
|
+
|
11
|
+
mall is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
14
|
+
License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
17
|
+
along with mall; if not, write to the Free Software Foundation, Inc.,
|
18
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
data/README
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
= Mall - access malloc tuning/reporting functions + glibc extras
|
2
|
+
|
3
|
+
This library provides access to the SysV mallinfo(3) and mallopt(3)
|
4
|
+
functions as well as (optionally) several glibc-specific malloc_*()
|
5
|
+
functions. Mall.opt, Mall.trim and Mall.xml are the most interesting.
|
6
|
+
|
7
|
+
Constants and functionality are defined at build time, so changing
|
8
|
+
your malloc implementation may require rebuilding and reinstalling
|
9
|
+
this library.
|
10
|
+
|
11
|
+
== Quick Start
|
12
|
+
|
13
|
+
> require 'mall'
|
14
|
+
|
15
|
+
> irb(main):007:0> Mall::info
|
16
|
+
|
17
|
+
=> {:arena=>12099584, :ordblks=>139, :smblks=>30, :hblks=>3, :hblkhd=>1650688, :usmblks=>0, :fsmblks=>1536, :uordblks=>12068400, :fordblks=>31184, :keepcost=>3616}
|
18
|
+
|
19
|
+
Where:
|
20
|
+
|
21
|
+
struct mallinfo2 {
|
22
|
+
size_t arena; /* Non-mmapped space allocated (bytes) */
|
23
|
+
size_t ordblks; /* Number of free chunks */
|
24
|
+
size_t smblks; /* Number of free fastbin blocks */
|
25
|
+
size_t hblks; /* Number of mmapped regions */
|
26
|
+
size_t hblkhd; /* Space allocated in mmapped regions (bytes) */
|
27
|
+
size_t usmblks; /* See below */
|
28
|
+
size_t fsmblks; /* Space in freed fastbin blocks (bytes) */
|
29
|
+
size_t uordblks; /* Total allocated space (bytes) */
|
30
|
+
size_t fordblks; /* Total free space (bytes) */
|
31
|
+
size_t keepcost; /* Top-most, releasable space (bytes) */
|
32
|
+
};
|
33
|
+
|
34
|
+
See `man 3 mallinfo2` (https://man7.org/linux/man-pages/man3/mallinfo.3.html).
|
35
|
+
|
36
|
+
irb(main):008:0> Mall::dump_stats
|
37
|
+
|
38
|
+
Arena 0:
|
39
|
+
system bytes = 12099584
|
40
|
+
in use bytes = 12065808
|
41
|
+
Total (incl. mmap):
|
42
|
+
system bytes = 13750272
|
43
|
+
in use bytes = 13716496
|
44
|
+
max mmap regions = 4
|
45
|
+
max mmap bytes = 1851392
|
46
|
+
|
47
|
+
=> nil
|
48
|
+
|
49
|
+
== Requirements
|
50
|
+
|
51
|
+
* A malloc implementation supporting mallinfo(3) and/or mallopt(3),
|
52
|
+
the ptmalloc-family of allocators used by glibc is recommended
|
53
|
+
and the only tested implementation.
|
54
|
+
|
55
|
+
== Build
|
56
|
+
|
57
|
+
gem install rake-compiler
|
58
|
+
rake build
|
59
|
+
|
60
|
+
== Install
|
61
|
+
|
62
|
+
git clone https://github.com/sitano/mall.git && cd mall && git co ivan
|
63
|
+
gem build mall.gemspec
|
64
|
+
gem install mall-1.0.2.gem
|
65
|
+
|
66
|
+
or add
|
67
|
+
|
68
|
+
gem 'mall', git: 'https://github.com/sitano/mall.git', branch: 'ivan'
|
69
|
+
|
70
|
+
and then:
|
71
|
+
|
72
|
+
$ bundle install
|
73
|
+
|
74
|
+
== SOURCE:
|
75
|
+
|
76
|
+
The original source code is available via git:
|
77
|
+
|
78
|
+
git://yhbt.net/mall.git
|
79
|
+
http://yhbt.net/mall.git
|
80
|
+
|
81
|
+
cgit repository viewer:
|
82
|
+
|
83
|
+
* http://yhbt.net/mall.git (cgit)
|
84
|
+
|
85
|
+
== Contact
|
86
|
+
|
87
|
+
All feedback (bug reports, user/development dicussion, patches, pull
|
88
|
+
requests) go to the mailing list: {mall@librelist.org}[mail@librelist.org]
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "mall"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/ext/mall/extconf.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
have_header('malloc.h') or abort "malloc.h header missing"
|
4
|
+
have_type('struct mallinfo', 'malloc.h') or abort 'struct mallinfo missing'
|
5
|
+
have_func('malloc_trim', 'malloc.h')
|
6
|
+
have_func('malloc_stats', 'malloc.h')
|
7
|
+
have_func('malloc_info', 'malloc.h')
|
8
|
+
|
9
|
+
PATH=File.expand_path(File.dirname(__FILE__))
|
10
|
+
system("erb #{PATH}/mall.c.erb > mall.c")
|
11
|
+
|
12
|
+
create_makefile('mall')
|