memcached 0.16.1 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/BENCHMARKS CHANGED
@@ -7,90 +7,49 @@ You can easily run your own benchmarks, as long as you have memcached itself on
7
7
 
8
8
  == x86-64 OS X
9
9
 
10
- These benchmarks were run on an OS X 10.5 Core 2 Duo machine (25,000 iterations):
10
+ These benchmarks were run on an OS X 10.5 Core 2 Duo machine (10,000 iterations):
11
11
 
12
- user system total real
13
- set:plain:noblock:memcached:net 0.650000 0.250000 0.900000 ( 2.165262)
14
- set:plain:noblock:memcached:uds 0.580000 0.140000 0.720000 ( 1.023195)
15
- set:plain:memcached:net 1.540000 2.440000 3.980000 ( 9.317136)
16
- set:plain:memcached:uds 1.230000 1.400000 2.630000 ( 4.919294)
17
- set:plain:memcache-client 21.030000 8.650000 29.680000 ( 31.999873)
18
- set:ruby:noblock:memcached:net 1.160000 0.250000 1.410000 ( 2.685066)
19
- set:ruby:noblock:memcached:uds 1.080000 0.160000 1.240000 ( 1.496034)
20
- set:ruby:memcached:net 2.250000 2.660000 4.910000 ( 10.650423)
21
- set:ruby:memcached:uds 1.930000 1.590000 3.520000 ( 6.051250)
22
- set:ruby:memcache-client 22.000000 8.780000 30.780000 ( 32.554235)
23
- get:plain:memcached:net 1.860000 2.720000 4.580000 ( 9.813708)
24
- get:plain:memcached:uds 1.540000 1.540000 3.080000 ( 5.065145)
25
- get:plain:memcache-client 25.040000 8.780000 33.820000 ( 35.932318)
26
- get:ruby:memcached:net 2.380000 2.780000 5.160000 ( 10.395301)
27
- get:ruby:memcached:uds 1.960000 1.590000 3.550000 ( 5.531036)
28
- get:ruby:memcache-client 25.490000 8.790000 34.280000 ( 36.092947)
29
- multiget:ruby:memcached:net 1.300000 0.970000 2.270000 ( 3.424010)
30
- multiget:ruby:memcached:uds 1.280000 0.720000 2.000000 ( 2.375904)
31
- multiget:ruby:memcache-client 13.380000 3.170000 16.550000 ( 17.743902)
32
- missing:ruby:memcached:net 2.450000 2.600000 5.050000 ( 9.982122)
33
- missing:ruby:memcached:uds 2.080000 1.600000 3.680000 ( 5.168750)
34
- missing:ruby:memcached:inline 2.370000 2.480000 4.850000 ( 10.374502)
35
- missing:ruby:memcached:uds:inline 2.020000 1.600000 3.620000 ( 5.315222)
36
- missing:ruby:memcache-client 21.200000 8.220000 29.420000 ( 30.533481)
37
- mixed:ruby:noblock:memcached:net 4.590000 6.050000 10.640000 ( 20.344957)
38
- mixed:ruby:noblock:memcached:uds 3.650000 2.650000 6.300000 ( 10.304713)
39
- mixed:ruby:memcached:net 4.580000 4.920000 9.500000 ( 19.785283)
40
- mixed:ruby:memcached:uds 3.850000 2.920000 6.770000 ( 10.850842)
41
- mixed:ruby:memcache-client 47.790000 16.510000 64.300000 ( 67.698660)
42
- hash:hsieh 0.050000 0.000000 0.050000 ( 0.051601)
43
- hash:fnv1_32 0.090000 0.000000 0.090000 ( 0.091872)
44
- hash:fnv1a_32 0.140000 0.000000 0.140000 ( 0.137040)
45
- hash:fnv1_64 0.240000 0.000000 0.240000 ( 0.246802)
46
- hash:fnv1a_64 0.130000 0.000000 0.130000 ( 0.133671)
47
- hash:murmur 0.090000 0.000000 0.090000 ( 0.095826)
48
- hash:default 0.120000 0.000000 0.120000 ( 0.124794)
49
- hash:jenkins 0.100000 0.010000 0.110000 ( 0.111693)
50
- hash:md5 0.230000 0.000000 0.230000 ( 0.229894)
51
- hash:crc 0.090000 0.000000 0.090000 ( 0.093286)
12
+ Ruby 1.8.7p174
13
+ Loaded memcached 0.16.2
14
+ Loaded memcache-client 1.7.4
15
+ user system total real
16
+ set:plain:noblock:memcached:net 0.270000 0.110000 0.380000 ( 0.911797)
17
+ set:plain:noblock:memcached:uds 0.250000 0.060000 0.310000 ( 0.471307)
18
+ set:plain:memcached:net 0.640000 0.980000 1.620000 ( 3.662495)
19
+ set:plain:memcached:uds 0.500000 0.560000 1.060000 ( 1.962946)
20
+ set:plain:memcache-client 7.640000 3.200000 10.840000 ( 11.264549)
21
+ set:ruby:noblock:memcached:net 0.450000 0.110000 0.560000 ( 1.049771)
22
+ set:ruby:noblock:memcached:uds 0.420000 0.060000 0.480000 ( 0.581246)
23
+ set:ruby:memcached:net 0.890000 0.990000 1.880000 ( 4.022136)
24
+ set:ruby:memcached:uds 0.770000 0.590000 1.360000 ( 2.462128)
25
+ set:ruby:memcache-client 7.210000 3.000000 10.210000 ( 12.328381)
26
+ get:plain:memcached:net 0.730000 0.970000 1.700000 ( 3.866983)
27
+ get:plain:memcached:uds 0.650000 0.600000 1.250000 ( 2.477487)
28
+ get:plain:memcache-client 8.340000 2.910000 11.250000 ( 12.963698)
29
+ get:ruby:memcached:net 0.910000 0.930000 1.840000 ( 4.232627)
30
+ get:ruby:memcached:uds 0.750000 0.580000 1.330000 ( 2.107293)
31
+ get:ruby:memcache-client 9.180000 3.160000 12.340000 ( 13.018086)
32
+ multiget:ruby:memcached:net 0.510000 0.360000 0.870000 ( 1.286799)
33
+ multiget:ruby:memcached:uds 0.500000 0.270000 0.770000 ( 0.957104)
34
+ multiget:ruby:memcache-client 5.000000 1.140000 6.140000 ( 6.357939)
35
+ missing:ruby:memcached:net 0.990000 1.040000 2.030000 ( 3.863125)
36
+ missing:ruby:memcached:uds 0.860000 0.650000 1.510000 ( 2.375266)
37
+ missing:ruby:memcached:inline 0.960000 1.030000 1.990000 ( 3.810818)
38
+ missing:ruby:memcached:uds:inline 0.830000 0.640000 1.470000 ( 2.189629)
39
+ missing:ruby:memcache-client 7.690000 3.180000 10.870000 ( 11.838813)
40
+ mixed:ruby:noblock:memcached:net 1.840000 2.530000 4.370000 ( 8.177355)
41
+ mixed:ruby:noblock:memcached:uds 1.420000 1.050000 2.470000 ( 4.167074)
42
+ mixed:ruby:memcached:net 1.830000 1.980000 3.810000 ( 7.666954)
43
+ mixed:ruby:memcached:uds 1.520000 1.160000 2.680000 ( 4.286830)
44
+ mixed:ruby:memcache-client 17.980000 6.490000 24.470000 ( 26.107002)
45
+ hash:murmur 0.040000 0.000000 0.040000 ( 0.039768)
46
+ hash:default 0.040000 0.000000 0.040000 ( 0.041131)
47
+ hash:jenkins 0.050000 0.000000 0.050000 ( 0.051128)
48
+ hash:md5 0.090000 0.010000 0.100000 ( 0.092318)
49
+ hash:crc 0.040000 0.000000 0.040000 ( 0.036825)
50
+ hash:hsieh 0.020000 0.000000 0.020000 ( 0.020522)
51
+ hash:fnv1_32 0.050000 0.000000 0.050000 ( 0.044151)
52
+ hash:fnv1a_32 0.040000 0.000000 0.040000 ( 0.046496)
53
+ hash:fnv1_64 0.100000 0.000000 0.100000 ( 0.110565)
54
+ hash:fnv1a_64 0.050000 0.000000 0.050000 ( 0.052217)
52
55
 
53
- == x86-64 Linux
54
-
55
- These benchmarks were run on a RHEL4 Xeon machine (25,000 iterations):
56
-
57
- user system total real
58
- set:plain:noblock:memcached:net 0.560000 0.370000 0.930000 ( 1.492691)
59
- set:plain:noblock:memcached:uds 0.500000 0.120000 0.620000 ( 0.837311)
60
- set:plain:memcached:net 1.070000 1.350000 2.420000 ( 4.655494)
61
- set:plain:memcached:uds 1.030000 0.590000 1.620000 ( 3.126471)
62
- set:plain:memcache-client 19.270000 1.500000 20.770000 ( 24.860087)
63
- set:ruby:noblock:memcached:net 1.090000 0.120000 1.210000 ( 2.583293)
64
- set:ruby:noblock:memcached:uds 1.100000 0.120000 1.220000 ( 1.501633)
65
- set:ruby:memcached:net 1.760000 1.410000 3.170000 ( 5.481738)
66
- set:ruby:memcached:uds 1.750000 0.590000 2.340000 ( 4.040445)
67
- set:ruby:memcache-client 19.490000 1.430000 20.920000 ( 24.545314)
68
- get:plain:memcached:net 1.160000 1.200000 2.360000 ( 4.515177)
69
- get:plain:memcached:uds 1.110000 0.630000 1.740000 ( 3.039308)
70
- get:plain:memcache-client 22.100000 1.440000 23.540000 ( 26.822877)
71
- get:ruby:memcached:net 1.770000 1.110000 2.880000 ( 5.029304)
72
- get:ruby:memcached:uds 1.680000 0.600000 2.280000 ( 3.241249)
73
- get:ruby:memcache-client 22.770000 1.430000 24.200000 ( 28.643709)
74
- multiget:ruby:memcached:net 1.030000 0.420000 1.450000 ( 2.132928)
75
- multiget:ruby:memcached:uds 1.080000 0.250000 1.330000 ( 1.914999)
76
- multiget:ruby:memcache-client 13.410000 0.520000 13.930000 ( 15.359580)
77
- missing:ruby:memcached:net 1.760000 1.290000 3.050000 ( 5.029804)
78
- missing:ruby:memcached:uds 1.730000 0.620000 2.350000 ( 3.772379)
79
- missing:ruby:memcached:inline 1.750000 1.220000 2.970000 ( 5.029707)
80
- missing:ruby:memcached:uds:inline 1.620000 0.670000 2.290000 ( 3.612413)
81
- missing:ruby:memcache-client 19.310000 1.360000 20.670000 ( 24.277446)
82
- mixed:ruby:noblock:memcached:net 3.530000 2.310000 5.840000 ( 10.037807)
83
- mixed:ruby:noblock:memcached:uds 3.270000 1.000000 4.270000 ( 6.980218)
84
- mixed:ruby:memcached:net 3.760000 2.510000 6.270000 ( 10.478885)
85
- mixed:ruby:memcached:uds 3.740000 1.190000 4.930000 ( 7.898747)
86
- mixed:ruby:memcache-client 45.900000 2.870000 48.770000 ( 56.733674)
87
- hash:hsieh 0.040000 0.000000 0.040000 ( 0.041816)
88
- hash:md5 0.120000 0.000000 0.120000 ( 0.121045)
89
- hash:fnv1_32 0.060000 0.000000 0.060000 ( 0.062099)
90
- hash:fnv1a_32 0.060000 0.000000 0.060000 ( 0.063173)
91
- hash:fnv1a_64 0.070000 0.000000 0.070000 ( 0.071170)
92
- hash:default 0.080000 0.000000 0.080000 ( 0.081224)
93
- hash:jenkins 0.050000 0.000000 0.050000 ( 0.053789)
94
- hash:fnv1_64 0.090000 0.000000 0.090000 ( 0.089719)
95
- hash:crc 0.080000 0.000000 0.080000 ( 0.079723)
96
- hash:murmur 0.050000 0.000000 0.050000 ( 0.048248)
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.16.2. Fix memory leak.
3
+
2
4
  v0.16.1. Use seeded random. Fix realloc bug on Linux.
3
5
 
4
6
  v0.16. Build properly on OS X Snow Leopard.
data/ext/extconf.rb CHANGED
@@ -38,9 +38,7 @@ if !ENV["EXTERNAL_LIB"]
38
38
 
39
39
  Dir.chdir(BUNDLE_PATH) do
40
40
 
41
- cflags = "-fPIC"
42
- cxxflags = cflags
43
- ldflags = "-fPIC"
41
+ cxxflags = cflags = ldflags = "-fPIC"
44
42
  extraconf = ''
45
43
 
46
44
  # again... is there a better way to do this?
@@ -50,6 +48,12 @@ if !ENV["EXTERNAL_LIB"]
50
48
  ldflags = "#{ldflags} #{archflags}"
51
49
  extraconf = '--enable-dtrace --disable-dependency-tracking'
52
50
  end
51
+
52
+ if ENV['DEBUG']
53
+ puts "Setting debug flags for libmemcached."
54
+ cflags << " -O0 -ggdb -DHAVE_DEBUG"
55
+ extraconf << " --enable-debug"
56
+ end
53
57
 
54
58
  puts(cmd = "env CFLAGS='#{cflags}' LDFLAGS='#{ldflags}' ./configure --prefix=#{HERE} --without-memcached --disable-shared --disable-utils #{extraconf} 2>&1")
55
59
  raise "'#{cmd}' failed" unless system(cmd)
@@ -58,7 +62,10 @@ if !ENV["EXTERNAL_LIB"]
58
62
  puts(cmd = "make install || true 2>&1")
59
63
  raise "'#{cmd}' failed" unless system(cmd)
60
64
  end
61
- system("rm -rf #{BUNDLE_PATH}") unless ENV['DEV']
65
+
66
+ unless ENV['DEBUG'] or ENV['DEV']
67
+ system("rm -rf #{BUNDLE_PATH}")
68
+ end
62
69
  end
63
70
  end
64
71
 
@@ -70,6 +77,15 @@ if !ENV["EXTERNAL_LIB"]
70
77
  $LIBS << " -lmemcached_gem"
71
78
  end
72
79
 
80
+ $CFLAGS.gsub! /-O\d/, ''
81
+
82
+ if ENV['DEBUG']
83
+ puts "Setting debug flags for gem."
84
+ $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
85
+ else
86
+ $CFLAGS << " -O3"
87
+ end
88
+
73
89
  if DARWIN
74
90
  $CFLAGS.gsub! /-arch \S+/, ''
75
91
  $CFLAGS << " #{archflags}"
@@ -83,13 +99,4 @@ if ENV['SWIG']
83
99
  raise "'#{cmd}' failed" unless system(cmd)
84
100
  end
85
101
 
86
- $CFLAGS.gsub! /-O\d/, ''
87
-
88
- if ENV['DEBUG']
89
- puts "Setting debug flags."
90
- $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
91
- else
92
- $CFLAGS << " -O3"
93
- end
94
-
95
102
  create_makefile 'rlibmemcached'
data/ext/rlibmemcached.i CHANGED
@@ -15,6 +15,9 @@
15
15
 
16
16
  // Register libmemcached's struct free function to prevent memory leaks
17
17
  %freefunc memcached_st "memcached_free";
18
+ %freefunc memcached_server_st "memcached_server_free";
19
+
20
+ // %trackobjects; // Doesn't fix any interesting leaks
18
21
 
19
22
  //// Input maps
20
23
 
@@ -11595,11 +11595,6 @@ fail:
11595
11595
  }
11596
11596
 
11597
11597
 
11598
- SWIGINTERN void
11599
- free_memcached_server_st(struct memcached_server_st *arg1) {
11600
- free((char *) arg1);
11601
- }
11602
-
11603
11598
  SWIGINTERN VALUE
11604
11599
  _wrap_memcached_server_cursor(int argc, VALUE *argv, VALUE self) {
11605
11600
  memcached_st *arg1 = (memcached_st *) 0 ;
@@ -13040,7 +13035,7 @@ SWIGEXPORT void Init_rlibmemcached(void) {
13040
13035
  rb_define_method(cMemcachedServerSt.klass, "hostname=", _wrap_MemcachedServerSt_hostname_set, -1);
13041
13036
  rb_define_method(cMemcachedServerSt.klass, "hostname", _wrap_MemcachedServerSt_hostname_get, -1);
13042
13037
  cMemcachedServerSt.mark = 0;
13043
- cMemcachedServerSt.destroy = (void (*)(void *)) free_memcached_server_st;
13038
+ cMemcachedServerSt.destroy = (void (*)(void *)) memcached_server_free;
13044
13039
  cMemcachedServerSt.trackObjects = 0;
13045
13040
  rb_define_module_function(mRlibmemcached, "memcached_server_cursor", _wrap_memcached_server_cursor, -1);
13046
13041
  rb_define_module_function(mRlibmemcached, "memcached_server_by_key", _wrap_memcached_server_by_key, -1);
@@ -137,9 +137,12 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
137
137
  # object.
138
138
  #
139
139
  def clone
140
- memcached = super
141
- memcached.instance_variable_set('@struct', Lib.memcached_clone(nil, @struct))
142
- memcached
140
+ # FIXME Memory leak
141
+ # memcached = super
142
+ # struct = Lib.memcached_clone(nil, @struct)
143
+ # memcached.instance_variable_set('@struct', struct)
144
+ # memcached
145
+ self.class.new(servers, options)
143
146
  end
144
147
 
145
148
  # Reset the state of the libmemcached struct. This is useful for changing the server list at runtime.
@@ -337,7 +340,11 @@ Please note that when pipelining is enabled, setter and deleter methods do not r
337
340
  # Return the server used by a particular key.
338
341
  def server_by_key(key)
339
342
  ret = Lib.memcached_server_by_key(@struct, key)
340
- inspect_server(ret.first) if ret.is_a?(Array)
343
+ if ret.is_a?(Array)
344
+ string = inspect_server(ret.first)
345
+ Rlibmemcached.memcached_server_free(ret.first)
346
+ string
347
+ end
341
348
  end
342
349
 
343
350
  # Return a Hash of statistics responses from the set of servers. Each value is an array with one entry for each server, in the same order the servers were defined.
data/memcached.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{memcached}
5
- s.version = "0.16.1"
5
+ s.version = "0.16.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver"]
@@ -11,6 +11,9 @@ begin; require 'memory'; rescue LoadError; end
11
11
 
12
12
  ARGV << "--with-memcached" << "--with-memcache-client" if ARGV.join !~ /--with/
13
13
 
14
+ puts `uname -a`
15
+ puts "Ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
16
+
14
17
  ARGV.each do |flag|
15
18
  require_name = flag[/--with-(\w+)/, 1]
16
19
  gem_name = flag[/--with-(.*)$/, 1]
@@ -9,6 +9,8 @@ class Worker
9
9
  def initialize(method_name, iterations)
10
10
  @method = method_name || 'mixed'
11
11
  @i = (iterations || 10000).to_i
12
+
13
+ puts "*** Running #{@method.inspect} test for #{@i} loops. ***"
12
14
 
13
15
  @key1 = "key1-"*8
14
16
  @key2 = "key2-"*8
@@ -102,17 +104,36 @@ class Worker
102
104
  @i.times do
103
105
  cache = @cache.clone
104
106
  end
107
+ when "reset"
108
+ @i.times do
109
+ @cache.reset
110
+ end
105
111
  when "servers"
106
112
  @i.times do
107
113
  @cache.servers
108
114
  end
115
+ when "server_by_key"
116
+ @i.times do
117
+ @cache.server_by_key(@key1)
118
+ end
109
119
  else
110
120
  raise "No such method"
111
121
  end
112
122
 
113
- GC.start
123
+ puts "*** Garbage collect. ***"
124
+ 10.times do
125
+ GC.start
126
+ sleep 0.1
127
+ end
128
+
129
+ sts, server_sts, clients = 0, 0, 0
130
+ ObjectSpace.each_object(Memcached) { clients += 1 }
131
+ ObjectSpace.each_object(Rlibmemcached::MemcachedSt) { sts += 1 }
132
+ ObjectSpace.each_object(Rlibmemcached::MemcachedServerSt) { server_sts += 1 }
133
+ puts "*** Structs: #{sts} ***"
134
+ puts "*** Server structs: #{server_sts} ***"
135
+ puts "*** Clients: #{clients} ***"
114
136
  end
115
-
116
137
  end
117
138
 
118
139
  Worker.new(ENV['METHOD'], ENV['LOOPS']).work
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- ]v>�2lS_LbRC��e�#b����?�PWAv��8T��gqOL���N�����6b9 w �'�!�;�n�j��Pb*o�hhl;y�uXF_;�P;�o//Ml�|��}���X8�R�' Q��m�[|�C,�_��ް%$���#��41z�#}���fǯ��tK3�Y��&��-�R��6�K"�44�v�|"�2�w?+�Ji��pΘ\8c�7/A'f���\2������8��C��꽲1� �E�m�sT�,�
1
+ t3Ir/G��&��2j#���ҩ�|���-8iwAt ��ҡ�-��ѝ��}-�_a ~���a�.<O��&P�Sic5v `���.���v��YIu��Ff®m�<�(�f������u�ԅ y0��6���} X<-�8�w$� 9�o���MF{�� ck���j��]*�ݔŴBz$�GXN�
2
+ �a��������� �*���P�a��b&s���\���e�]G�&�*���v�2}e�g:l�