je 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +24 -0
- data/bin/je +9 -2
- data/ext/jemalloc/extconf.rb +6 -2
- data/lib/je/version.rb +1 -1
- metadata +26 -9
data/Gemfile.lock
CHANGED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# je - Instant [jemalloc](http://www.canonware.com/jemalloc/) injection into Ruby apps
|
2
|
+
|
3
|
+
jemalloc sometimes dramatically supresses the memory fragmentation on server programs. `je` gem contains jemalloc itself within a gem, and enables you to inject jemalloc into your application in a really easy way: install `je` gem, and launch your app with `je` command.
|
4
|
+
|
5
|
+
# Install
|
6
|
+
|
7
|
+
Install `je` gem in your application. For [bundler](http://gembundler.com/) based application, please add the following line into your Gemfile, and and install `je` by `bundle install`.
|
8
|
+
|
9
|
+
gem 'je'
|
10
|
+
|
11
|
+
# Usage
|
12
|
+
|
13
|
+
Execute your application with `je` command, which is contained in `je` gem. Example command for Rails + bundler application is like follows.
|
14
|
+
|
15
|
+
|
16
|
+
$ bundle exec je ./script/rails s
|
17
|
+
|
18
|
+
# TODO
|
19
|
+
|
20
|
+
Currently, this gem works only on Linux. Not working on Windows and Mac OS X.
|
21
|
+
|
22
|
+
# License
|
23
|
+
|
24
|
+
[BSD-derived License](http://www.canonware.com/jemalloc/license.html).
|
data/bin/je
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# Set ENV for preloading jemalloc
|
3
4
|
lib_dir = File.expand_path('../lib/', File.dirname(__FILE__))
|
4
|
-
|
5
|
-
|
5
|
+
if File.exists? (lib_dir + "/jemalloc.so")
|
6
|
+
puts "Injecting jemalloc..."
|
7
|
+
ENV.store("LD_PRELOAD", jemalloc_path)
|
8
|
+
else
|
9
|
+
puts "Skip injecting jemalloc..."
|
10
|
+
end
|
6
11
|
|
12
|
+
# fork(2) and exec(2)
|
7
13
|
pid = Process.fork
|
8
14
|
if pid.nil? then
|
9
15
|
Kernel.exec *ARGV
|
10
16
|
else
|
11
17
|
pid, status = Process.wait2
|
18
|
+
Kernel.exit status.exitstatus
|
12
19
|
end
|
data/ext/jemalloc/extconf.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'mkmf'
|
2
|
+
require 'rbconfig'
|
2
3
|
require File.expand_path('../../lib/je/version', File.dirname(__FILE__))
|
3
4
|
|
4
5
|
$stdout.sync = true
|
@@ -14,8 +15,11 @@ Dir.chdir File.dirname(__FILE__) do
|
|
14
15
|
puts `./configure`
|
15
16
|
# mkmf only allows *.c file on current dir
|
16
17
|
puts `cp src/*.c ../`
|
17
|
-
# zone.c is only for OS X
|
18
|
-
|
18
|
+
# zone.c is only for Mac OS X
|
19
|
+
if RbConfig::CONFIG['target_vendor'] != "apple"
|
20
|
+
puts `rm -fR ../zone.c`
|
21
|
+
end
|
22
|
+
exit
|
19
23
|
end
|
20
24
|
end
|
21
25
|
Dir.chdir cur_dir
|
data/lib/je/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: je
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 0.8.7
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.7
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake-compiler
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: 0.7.1
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.1
|
47
62
|
description: Use jemalloc as default allocator, everywhere!
|
48
63
|
email: kazuki.ohta@gmail.com
|
49
64
|
executables:
|
@@ -55,6 +70,7 @@ files:
|
|
55
70
|
- .gitignore
|
56
71
|
- Gemfile
|
57
72
|
- Gemfile.lock
|
73
|
+
- README.md
|
58
74
|
- Rakefile
|
59
75
|
- bin/je
|
60
76
|
- ext/jemalloc/extconf.rb
|
@@ -81,8 +97,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
97
|
version: '0'
|
82
98
|
requirements: []
|
83
99
|
rubyforge_project:
|
84
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.21
|
85
101
|
signing_key:
|
86
102
|
specification_version: 3
|
87
103
|
summary: use jemalloc as default allocator, everywhere!
|
88
104
|
test_files: []
|
105
|
+
has_rdoc:
|