cloudflare / quiche

šŸ„§ Savoury implementation of the QUIC transport protocol and HTTP/3

Home Page:https://docs.quic.tech/quiche/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak with FFI on 0.20.1

nunojpg opened this issue Ā· comments

For every stream connected/disconnected I get about 1,5kB of "possibly lost" memory from valgrind.
I see this memory growing over a few days, without ever being reclaimed, so I assume it's really lost.
Valgrind reports this 4 blocks for every stream:

==1604442== by 0x47F2F6: UnknownInlinedFun (alloc.rs:102)
==1604442== by 0x47F2F6: UnknownInlinedFun (alloc.rs:185)
==1604442== by 0x47F2F6: UnknownInlinedFun (alloc.rs:245)
==1604442== by 0x47F2F6: UnknownInlinedFun (alloc.rs:334)
==1604442== by 0x47F2F6: UnknownInlinedFun (boxed.rs:217)
==1604442== by 0x47F2F6: UnknownInlinedFun (sync.rs:369)
==1604442== by 0x47F2F6: UnknownInlinedFun (mod.rs:935)
==1604442== by 0x47F2F6: quiche::stream::recv_buf::RecvBuf::reset (recv_buf.rs:283)
==1604442== by 0x45D27E: quiche::Connection::process_frame (lib.rs:6744)
==1604442== by 0x44ECE7: recv_single (lib.rs:2791)
==1604442== by 0x44ECE7: quiche::Connection::recv (lib.rs:2187)
==1604442== by 0x2EE144: quiche_conn_recv (ffi.rs:744)

==1604442== by 0x4ADE25: alloc (alloc.rs:102)
==1604442== by 0x4ADE25: alloc_impl (alloc.rs:185)
==1604442== by 0x4ADE25: allocate (alloc.rs:245)
==1604442== by 0x4ADE25: exchange_malloc (alloc.rs:334)
==1604442== by 0x4ADE25: new<alloc::sync::ArcInnerquiche::stream::StreamPriorityKey> (boxed.rs:217)
==1604442== by 0x4ADE25: newquiche::stream::StreamPriorityKey (sync.rs:369)
==1604442== by 0x4ADE25: new (mod.rs:680)
==1604442== by 0x4ADE25: quiche::stream::StreamMap::get_or_create (mod.rs:301)
==1604442== by 0x45772C: get_or_create_stream (lib.rs:6647)
==1604442== by 0x45772C: quiche::Connection::stream_send (lib.rs:4636)
==1604442== by 0x2EE68A: quiche_conn_stream_send (ffi.rs:846)

==1604442== by 0x4C7027: alloc::raw_vec::finish_grow (raw_vec.rs:0)
==1604442== by 0x4C776E: grow_amortized<quiche::h3::Header, alloc::alloc::Global> (raw_vec.rs:404)
==1604442== by 0x4C776E: alloc::raw_vec::RawVec<T,A>::reserve_for_push (raw_vec.rs:302)
==1604442== by 0x48AB73: alloc::collections::vec_deque::VecDeque<T,A>::grow (mod.rs:2061)
==1604442== by 0x47F888: UnknownInlinedFun (mod.rs:1659)
==1604442== by 0x47F888: quiche::stream::send_buf::SendBuf::write (send_buf.rs:159)
==1604442== by 0x4579A1: quiche::Connection::stream_send (lib.rs:4672)
==1604442== by 0x2EE68A: quiche_conn_stream_send (ffi.rs:846)

==1604442== by 0x4C35F7: UnknownInlinedFun (alloc.rs:102)
==1604442== by 0x4C35F7: UnknownInlinedFun (alloc.rs:185)
==1604442== by 0x4C35F7: UnknownInlinedFun (alloc.rs:245)
==1604442== by 0x4C35F7: UnknownInlinedFun (boxed.rs:483)
==1604442== by 0x4C35F7: UnknownInlinedFun (boxed.rs:448)
==1604442== by 0x4C35F7: UnknownInlinedFun (node.rs:83)
==1604442== by 0x4C35F7: new_leaf<u64, quiche::stream::RangeBuf, alloc::alloc::Global> (node.rs:217)
==1604442== by 0x4C35F7: alloc::collections::btree::map::entry::VacantEntry<K,V,A>::insert (entry.rs:355)
==1604442== by 0x47E570: UnknownInlinedFun (map.rs:1006)
==1604442== by 0x47E570: quiche::stream::recv_buf::RecvBuf::write (recv_buf.rs:188)
==1604442== by 0x47F342: quiche::stream::recv_buf::RecvBuf::reset (recv_buf.rs:284)
==1604442== by 0x45D27E: quiche::Connection::process_frame (lib.rs:6744)
==1604442== by 0x44ECE7: recv_single (lib.rs:2791)
==1604442== by 0x44ECE7: quiche::Connection::recv (lib.rs:2187)
==1604442== by 0x2EE144: quiche_conn_recv (ffi.rs:744)