[ENet-discuss] packet->referenceCount greater than zero

Doug Kimzey doug.kimzey at dpra.com
Wed Mar 19 06:34:03 PDT 2008


Hello,

 

I have been troubleshooting a memory leak in my application that uses
eNet.  I suspect that we need to do some cleanup on sent packets but
would like some guidance - (so please correct me where I am wrong).

 

*         Packets are usually only destroyed when the
_ENetPacket::referenceCount field is equal to 0

*         In walking through my code:

o   A packet is successfully created - and the newly created packet has
a referenceCount of 0

o   ::enet_peer_send(...) queues the packet fragments when the packet
size exceeds the fragment length.  For each fragment in the packet,
::enet_peer_queue_outgoing_command(...) is called.

o   In ::enet_peer_queue_outgoing_command(...):

 

*         An ENetOutgoingCommand is allocated and initialized

*         The packet->referenceCount is incremented.

o   ::enet_peer_send returns 0 (success)

o   My packet->referenceCount is greater than 0 - so my call to
::enet_packet_destroy(...) is not made and the packet memory is not
freed.

 

Is there an enet function that should be called after ::enet_peer_send
that will verify the packet was indeed sent and decrement the
packet->referenceCount before calling ::enet_packet_destroy?

 

Thank you,

Doug Kimzey

Doug.kimzey at dpra.com

DPRA, Inc.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cubik.org/pipermail/enet-discuss/attachments/20080319/d592d3c7/attachment.htm 


More information about the ENet-discuss mailing list