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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,32ab3f0888d7e4b2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "markp" Newsgroups: comp.lang.ada Subject: Re: Memory Leak Date: 3 Jan 2006 11:05:18 -0800 Organization: http://groups.google.com Message-ID: <1136315117.916153.244720@f14g2000cwb.googlegroups.com> References: <1136304945.663764.14490@g14g2000cwa.googlegroups.com> <1136314666.226780.277280@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 157.127.124.141 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1136315124 4544 127.0.0.1 (3 Jan 2006 19:05:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 3 Jan 2006 19:05:24 +0000 (UTC) In-Reply-To: <1136314666.226780.277280@g14g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; H010818; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=157.127.124.141; posting-account=_Inhcg0AAAAPC2BsuUqoGG-atarvM4_J Xref: g2news1.google.com comp.lang.ada:2434 Date: 2006-01-03T11:05:18-08:00 List-Id: A couple of more things I should mention: I am running this under Windows, not Linux. Also, I instantiate this queue package in a package body that contains a task body. Here's how it's instantiated/used: with Generic_Message_Queues; pragma Elaborate (Generic_Message_Queues); with text_io; with Ada.Exceptions; package body Process_Data is type Queue_Messages_Type is ( Small_Msg, Large_Msg); type Queue_Msg(Msg : Queue_Messages_Type := Small_Msg) is record case Msg is when Small_Msg => Small_Msg_Data : Interface_Types.Small_Msg_Type; when Large_Msg => Large_Msg_Data : Interface_Types.Large_Msg_Type; end case; end record; -- Queue definition package My_Queue is new Generic_Message_Queues( Data_Type => Queue_Msg, Message_Queue_Depth => 100, Queue_Name => "Process Task Queue"); task Processing_Task is entry Start; pragma storage_size(12_048_000); pragma priority(15); end Processing_Task; task body Processing_Task is Queue_Data : Queue_Msg; Small_Msg_Data : Interface_Types.Small_Msg_Type; Large_Msg_Data : Interface_Types.Large_Msg_Type; begin loop Accept Start; loop -- Pend for data on queue - this is a blocking call My_Queue.Get( Data => Queue_Data); case Queue_Data.Msg is when Small_Msg => Small_Msg_Data := Queue_Data.Small_Msg_Data; text_io.put_line("Received Small Msg"); when Large_Msg => Large_Msg_Data := Queue_Data.Large_Msg_Data; text_io.put_line("Received Large Msg"); end case; end loop; end loop; exception when Current_Exception : others => text_io.put_line("Unhandled "&Ada.Exceptions.exception_information( Current_Exception)); end Processing_Task; procedure Start is begin Processing_Task.Start; end Start; procedure Process_Small_Msg( Msg : in Interface_Types.Small_Msg_Type) is begin My_Queue.Put( Data => ( Msg => Small_Msg, Small_Msg_Data => Msg), Priority_Urgency => My_Queue.Normal); end Process_Small_Msg; procedure Process_Large_Msg( Msg : in Interface_Types.Large_Msg_Type) is begin My_Queue.Put( Data => ( Msg => Large_Msg, Large_Msg_Data => Msg), Priority_Urgency => My_Queue.Normal); end Process_Large_Msg; end Process_Data;