[PATCH 1/2] Test case for memory leak in gets command.

Tomash Brechko tomash.brechko at gmail.com
Sun Nov 11 17:39:44 UTC 2007


Use it to see how memory footprint grows.

WARNING: the test is indefinite, before committing set proper
iteration count.
---
 trunk/server/t/cas_leak.t |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 trunk/server/t/cas_leak.t

diff --git a/trunk/server/t/cas_leak.t b/trunk/server/t/cas_leak.t
new file mode 100644
index 0000000..17bf246
--- /dev/null
+++ b/trunk/server/t/cas_leak.t
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 1;
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use MemcachedTest;
+
+
+my $server = new_memcached();
+my $sock = $server->sock;
+
+
+while (1) {
+    print $sock "set foo 0 0 6\r\nbarval\r\n";
+    my $reply = scalar <$sock>;
+    die $reply if $reply ne "STORED\r\n";
+
+    print $sock "gets foo\r\n";
+    $reply = join('', scalar <$sock>, scalar <$sock>, scalar <$sock>);
+    die $reply if $reply !~ /^VALUE foo 0 6 \d+\r\nbarval\r\nEND\r\n$/;
+}
-- 
1.5.3.5.529.ge3d6d


More information about the memcached mailing list