From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec2a500cce3658c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: Subject: Re: Memory leak - What the ...? Date: Wed, 13 Oct 2004 10:53:58 -0400 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <416d3e99$0$74186$39cecf19@news.twtelecom.net> Organization: Time-Warner Telecom NNTP-Posting-Date: 13 Oct 2004 14:41:29 GMT NNTP-Posting-Host: 9ec9fb12.news.twtelecom.net X-Trace: DXC=hbG_B28m=2BP;Ll>D9?]MBC_A=>8kQj6MMOj3YM9`=aHco=dW1mZJ3BdYZAA8S: "Alex R. Mosteo" wrote in message news:dcb57d1e.0410120707.256204ff@posting.google.com... > if Is_empty (Udp_msgs) then > Next_sending := Clock + 1.0; > else > Msg := First_Element (Udp_msgs); > Delete_first (Udp_msgs); > > Socket.Send ( > Udp_Socket, > Msg.Data (Msg.Data'First .. Msg.Last), > Last, -- Out value with the last sent component (should be > Msg.Last) > Msg.Dest); Note that function First_Element is going to make a copy of the element. Your element type is controlled, and uses allocation, so this isn't going to be cheap. I recommend instead that you refer to the element in place: else declare procedure Send (Msg : UDP_Msg_T) is begin Send (UDP_Socket, Msg.Data (...), ...); end; begin Query_Element (First (UDP_Msgs), Send'Access); --Ada 2005 end; Delete_First (UDP_Msgs); ... end if;