Skip to content

Commit

Permalink
pillowfight.cc: fix leaking event loop descriptors
Browse files Browse the repository at this point in the history
==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
avsej authored and trondn committed Mar 11, 2013
1 parent 1e95372 commit ecbb9fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions example/pillowfight/pillowfight.cc
Expand Up @@ -272,9 +272,7 @@ class ThreadContext
{ {
public: public:
ThreadContext(size_t poolSize) : ThreadContext(size_t poolSize) :
currSeqno(0), pool(0) { currSeqno(0), pool(0), io(NULL) {
// @todo fill the random seqnos
lcb_io_opt_t io;
lcb_error_t err = lcb_create_io_ops(&io, NULL); lcb_error_t err = lcb_create_io_ops(&io, NULL);
if (err != LCB_SUCCESS) { if (err != LCB_SUCCESS) {
std::cerr << "Failed to create IO option: " std::cerr << "Failed to create IO option: "
Expand All @@ -290,6 +288,7 @@ class ThreadContext


~ThreadContext() { ~ThreadContext() {
delete pool; delete pool;
lcb_destroy_io_ops(io);
} }


bool run(bool loop) { bool run(bool loop) {
Expand Down Expand Up @@ -415,6 +414,7 @@ class ThreadContext


lcb_error_t error; lcb_error_t error;
InstancePool *pool; InstancePool *pool;
lcb_io_opt_t io;
}; };


static void storageCallback(lcb_t, const void *cookie, static void storageCallback(lcb_t, const void *cookie,
Expand Down

0 comments on commit ecbb9fb

Please sign in to comment.