Skip to content
Browse files

pillowfight.cc: fix leaking event loop descriptors

==31400== FILE DESCRIPTORS: 4 open at exit.
==31400== Open file descriptor 3:
==31400==    at 0x5AD6047: epoll_create1 (syscall-template.S:82)
==31400==    by 0x638BC9C: epoll_init (ev_epoll.c:239)
==31400==    by 0x638CED1: loop_init (ev.c:2610)
==31400==    by 0x638D67B: ev_loop_new (ev.c:2787)
==31400==    by 0x6186829: lcb_create_libev_io_opts (plugin-libev.c:399)
==31400==    by 0x4E46B57: create_v1 (iofactory.c:232)
==31400==    by 0x4E46A73: create_v0 (iofactory.c:198)
==31400==    by 0x4E469A4: lcb_create_io_ops (iofactory.c:172)
==31400==    by 0x404F20: ThreadContext::ThreadContext(unsigned long) (pillowfight.cc:278)
==31400==    by 0x40417D: main (pillowfight.cc:592)

Change-Id: I8b30d6b0a6e778918be4ec2efed780393a2c4ad4
Reviewed-on: http://review.couchbase.org/25082
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent 1e95372 commit ecbb9fb208ed9b2fab8264e599de8e4099d8b11b @avsej avsej committed with trondn Mar 11, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 example/pillowfight/pillowfight.cc
View
6 example/pillowfight/pillowfight.cc
@@ -272,9 +272,7 @@ class ThreadContext
{
public:
ThreadContext(size_t poolSize) :
- currSeqno(0), pool(0) {
- // @todo fill the random seqnos
- lcb_io_opt_t io;
+ currSeqno(0), pool(0), io(NULL) {
lcb_error_t err = lcb_create_io_ops(&io, NULL);
if (err != LCB_SUCCESS) {
std::cerr << "Failed to create IO option: "
@@ -290,6 +288,7 @@ class ThreadContext
~ThreadContext() {
delete pool;
+ lcb_destroy_io_ops(io);
}
bool run(bool loop) {
@@ -415,6 +414,7 @@ class ThreadContext
lcb_error_t error;
InstancePool *pool;
+ lcb_io_opt_t io;
};
static void storageCallback(lcb_t, const void *cookie,

0 comments on commit ecbb9fb

Please sign in to comment.
Something went wrong with that request. Please try again.