зеркало из https://github.com/github/memcached.git
Fix memory leak in memcached_mget().
This commit is contained in:
Родитель
94cac4c64d
Коммит
c538f37035
|
@ -1,3 +1,5 @@
|
|||
v1.1.2. Fix memory leak in memcached_mget().
|
||||
|
||||
v1.1.1. Speed up multiget. Don't cast types on unmarshalled set.
|
||||
|
||||
v1.1. TTL interface requires Fixnums.
|
||||
|
|
|
@ -41,19 +41,8 @@
|
|||
$1[i] = StringValuePtr(RARRAY_PTR($input)[i]);
|
||||
}
|
||||
}
|
||||
%typemap(in) (char **keys, size_t *key_length, unsigned int number_of_keys) {
|
||||
int i;
|
||||
Check_Type($input, T_ARRAY);
|
||||
$3 = (unsigned int) RARRAY_LEN($input);
|
||||
$2 = (size_t *) malloc(($3+1)*sizeof(size_t));
|
||||
$1 = (char **) malloc(($3+1)*sizeof(char *));
|
||||
for(i = 0; i < $3; i ++) {
|
||||
Check_Type(RARRAY_PTR($input)[i], T_STRING);
|
||||
$2[i] = RSTRING_LEN(RARRAY_PTR($input)[i]);
|
||||
$1[i] = StringValuePtr(RARRAY_PTR($input)[i]);
|
||||
}
|
||||
}
|
||||
%typemap(freearg) (char **keys, size_t *key_length, size_t number_of_keys) {
|
||||
|
||||
%typemap(freearg) (const char **keys, size_t *key_length, size_t number_of_keys) {
|
||||
free($1);
|
||||
free($2);
|
||||
}
|
||||
|
|
|
@ -8849,8 +8849,16 @@ _wrap_memcached_mget(int argc, VALUE *argv, VALUE self) {
|
|||
}
|
||||
result = (memcached_return)memcached_mget(arg1,(char const **)arg2,arg3,arg4);
|
||||
vresult = SWIG_From_int((int)(result));
|
||||
{
|
||||
free(arg2);
|
||||
free(arg3);
|
||||
}
|
||||
return vresult;
|
||||
fail:
|
||||
{
|
||||
free(arg2);
|
||||
free(arg3);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -8896,8 +8904,16 @@ _wrap_memcached_mget_len(int argc, VALUE *argv, VALUE self) {
|
|||
arg5 = (uint32_t)(val5);
|
||||
result = (memcached_return)memcached_mget_len(arg1,(char const **)arg2,arg3,arg4,arg5);
|
||||
vresult = SWIG_From_int((int)(result));
|
||||
{
|
||||
free(arg2);
|
||||
free(arg3);
|
||||
}
|
||||
return vresult;
|
||||
fail:
|
||||
{
|
||||
free(arg2);
|
||||
free(arg3);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -9031,9 +9047,17 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
|
|||
result = (memcached_return)memcached_mget_by_key(arg1,(char const *)arg2,arg3,(char const **)arg4,arg5,arg6,arg7);
|
||||
vresult = SWIG_From_int((int)(result));
|
||||
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||
{
|
||||
free(arg4);
|
||||
free(arg5);
|
||||
}
|
||||
return vresult;
|
||||
fail:
|
||||
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
||||
{
|
||||
free(arg4);
|
||||
free(arg5);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class Worker
|
|||
end
|
||||
when "multiget"
|
||||
@i.times do
|
||||
@cache.get([@key1, @key2])
|
||||
@cache.get([@key1, @key2, @key3])
|
||||
end
|
||||
when "clone"
|
||||
@i.times do
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
require "#{File.dirname(__FILE__)}/../setup"
|
||||
|
||||
exec("valgrind --tool=memcheck --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --max-stackframe=7304328 --dsymutil=yes --track-origins=yes ruby -r#{File.dirname(__FILE__)}/exercise.rb -e \"Worker.new('mixed', 10000, 'true').work\"")
|
||||
exec("valgrind --tool=memcheck --error-limit=no --leak-check=full --show-reachable=no --num-callers=15 --track-fds=yes --workaround-gcc296-bugs=yes --max-stackframe=7304328 --dsymutil=yes --track-origins=yes ruby -r#{File.dirname(__FILE__)}/exercise.rb -e \"Worker.new(ENV['TEST'] || 'mixed', 500, 'true').work\"")
|
||||
|
|
Загрузка…
Ссылка в новой задаче