Closed HDegroote closed 1 month ago
The result of dht replies are often kept around for a long time (for example to populate hypercore's peerInfo objects).
The buffers coming into decodeReply are slab-allocated from udx buffers (~68kb), so large slabs of memory were kept from being garbage collected.
This PR copies the data into a dedicated slab
Note: the buffers of closestNodes are not copied out, because those are assumed to be ephemeral
closestNodes
Note: I didn't know how to test the to.id field (unsure when it's set)
to.id
This PR is no longer relevant (we put the responsibility of unslabbing at the caller of the queries)
The result of dht replies are often kept around for a long time (for example to populate hypercore's peerInfo objects).
The buffers coming into decodeReply are slab-allocated from udx buffers (~68kb), so large slabs of memory were kept from being garbage collected.
This PR copies the data into a dedicated slab
Note: the buffers of
closestNodes
are not copied out, because those are assumed to be ephemeralNote: I didn't know how to test the
to.id
field (unsure when it's set)