memory leak about leveldb and replicant?

35 views
Skip to first unread message

李俊良

unread,
Feb 16, 2016, 4:35:06 AM2/16/16
to hyperdex-discuss
I tested the value over 100M, found memory leak.
        comparisons_(new uint64_t[n]),
        heap_
(new unsigned[n]),

So need free them when destruct
virtual ~MergingIterator() {
   
delete[] children_;
   
delete[] comparisons_;
   
delete[] heap_;
}

In addition, ./client/pending_cond_follow.cc:handle_response
140                 if (*m_data)
141                 {
142                     *m_data = static_cast<char*>(realloc(*m_data, data.size()));
143                 }
144                 else
145                 {
146                     *m_data = static_cast<char*>(malloc(data.size()));
147                 }
148


m_data not free, This problem can be detected from cppcheck or valgrind

Robert Escriva

unread,
Feb 16, 2016, 11:53:17 AM2/16/16
to hyperdex...@googlegroups.com
Thank you for catching these!

I've updated the code in Git with the appropriate fixes.

-Robert
> --
> You received this message because you are subscribed to the Google Groups
> "hyperdex-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to hyperdex-discu...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

李俊良

unread,
Feb 16, 2016, 8:17:24 PM2/16/16
to hyperdex-discuss
m_data is char ** ,  it should free *m_data

在 2016年2月17日星期三 UTC+8上午12:53:17,Robert Escriva写道:

Robert Escriva

unread,
Feb 16, 2016, 9:20:01 PM2/16/16
to hyperdex...@googlegroups.com
Good catch! Thank you.

-Robert

李俊良

unread,
Feb 16, 2016, 9:36:43 PM2/16/16
to hyperdex-discuss
the pending of pending_cond_follow in client.cc could be inserted into map, maybe the best way to explicitly release


在 2016年2月17日星期三 UTC+8上午12:53:17,Robert Escriva写道:
Thank you for catching these!

Robert Escriva

unread,
Feb 16, 2016, 10:30:02 PM2/16/16
to hyperdex...@googlegroups.com
I'm currently working on running valgrind behind every test in the
Replicant suite, and some tests that will exercise this and other paths.
I don't want to keep playing whack-a-mole.

-Robert

李俊良

unread,
Feb 17, 2016, 2:59:08 AM2/17/16
to hyperdex-discuss
how to run gremlin test? :)

在 2016年2月17日星期三 UTC+8上午11:30:02,Robert Escriva写道:

Robert Escriva

unread,
Feb 17, 2016, 8:50:12 AM2/17/16
to hyperdex...@googlegroups.com
I've pushed that go GitHub here: https://github.com/rescrv/gremlin

Add the "gremlin" file in that repository to your path and make sure you
have Python 3 installed. Then everything should work with "make check".

To run additional tests, you should run configure like this:

./configure --enable-example-state-machines

I'm still cleaning up the valgrind errors in Replicant, so feel free to
look around, but be aware I'll be changing things for the better. :-)

-Robert

李俊良

unread,
Feb 17, 2016, 7:59:20 PM2/17/16
to hyperdex-discuss
thanks :)

在 2016年2月17日星期三 UTC+8下午9:50:12,Robert Escriva写道:
Reply all
Reply to author
Forward
0 new messages