K2InformaticsGmbH / erloci

Erlang Oracle native driver - DEPRECATED, see https://github.com/K2InformaticsGmbH/oranif instead
Apache License 2.0
37 stars 11 forks source link

Memory Leak #58

Closed c-bik closed 5 years ago

c-bik commented 6 years ago

One of the leaks is https://github.com/K2InformaticsGmbH/cpro/issues/477#issuecomment-385623499

c-bik commented 5 years ago

The valgrind report:

Thread 1:
 40 bytes in 10 blocks are definitely lost in loss record 94 of 327
 at 0x4C28203: operator new(unsigned long) (vg_replace_malloc.c:334)
 by 0x4082A9: map_value_to_bind_args(term&, std::vector<var, std::allocator<var> >&) (marshal.cpp:416)
 by 0x41289B: command::exec_stmt(term&, term&) (command.cpp:526)
 by 0x414DAE: command::process(term&) (command.cpp:878)
 by 0x41A18E: ProcessCommandCb(void*) (threads.cpp:201)
 by 0x415DB1: threadpool_thread(void*) (threadpool.cpp:284)
 by 0x5083DC4: start_thread (in /usr/lib64/libpthread-2.17.so)
 by 0xAF3C73C: clone (in /usr/lib64/libc-2.17.so)

is saying that cleanup attempt

https://github.com/K2InformaticsGmbH/erloci/blob/f9667de3fb54b7311dcd2e08275c76a98a392184/c_src/erloci_drv/marshal.cpp#L347

is not deallocating pointers to different types in the vector

https://github.com/K2InformaticsGmbH/erloci/blob/d3c8921a83b725cb5f7070c4c358e555289ae2dc/c_src/erloci_lib/lib_interface.h#L61

collected as follows

https://github.com/K2InformaticsGmbH/erloci/blob/f9667de3fb54b7311dcd2e08275c76a98a392184/c_src/erloci_drv/marshal.cpp#L341 https://github.com/K2InformaticsGmbH/erloci/blob/f9667de3fb54b7311dcd2e08275c76a98a392184/c_src/erloci_drv/marshal.cpp#L390 https://github.com/K2InformaticsGmbH/erloci/blob/f9667de3fb54b7311dcd2e08275c76a98a392184/c_src/erloci_drv/marshal.cpp#L428 ... https://github.com/K2InformaticsGmbH/erloci/blob/f9667de3fb54b7311dcd2e08275c76a98a392184/c_src/erloci_drv/marshal.cpp#L508