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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b3258fa06e2efdf3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-10 22:35:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Sun, 11 May 2003 00:35:45 -0500 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: Tasks unleashed Date: Sun, 11 May 2003 17:35:40 +1200 Message-ID: References: <5Ejsa.430589$OV.427578@rwcrnsc54> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone5.qsi.net.nz!unknown@tnt1-321.quicksilver.net.nz X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone5-svc-skyt.qsi.net.nz X-Original-Trace: 11 May 2003 17:35:40 +1200, drone5-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-F6BrBs1z+jIa3CWwseFFycJnAviR1FbCuhfqrzRB4Dv+W3opkgCpJuTVtQRFAKJjPxytdTtaVkbfJW2!X0hWRNwf7kawUvFDV6GICh7YBSDO2TSTEIZnBb/SjgXuTchssOovhCHdUpVNUq3jJQ/JAUfAYykF!D0aTGGU= X-Complaints-To: Complaints to abuse@clear.net.nz X-DMCA-Complaints-To: Complaints to abuse@clear.net.nz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:37173 Date: 2003-05-11T17:35:40+12:00 List-Id: On Fri, 2 May 2003 13:21:13 +0200, Jano wrote: >tmoran@acm.org dice... >> >In any case, the memory thing forces to use pools of reusable tasks, >> >it's my main and crucial conclusion. >> >> Have you considered a protected Buffer of work to do and a fixed pool of >> tasks which queue on an entry waiting for the Buffer to have some work to >> do (or instructions to quit)? Then you needn't create or destroy the >> worker tasks. > >That's exactly what I'm doing :) but sometimes the "fixed" compromise >bugs me. ITOH, normally is better to have a upper bound for things, I >think. The problem of Ada tasks leaking memory, is 100% absent if the program is written well enough and either of the 2 compilers named here, are used (in Windows). Recovering the memory of a task silently fails if the task was not finished. ** Test 1: the memory leak is completely absent: for K in 1 .. 20_000 loop -- N=20,000 X := new A.Tt; N := N + 1; X.The_End; delay 1.0E-30; -- [1] Free (X); -- [2] end loop; ObjectAda: 596K for both N=1,000 and N=200,000 GNAT 3.15: 760K, for both N=1,000 and N=200,000 1024 / 200,000 < 1, so no memory was being leaked for each deallocated task (in Windows 2000, OA 7.2.2, GNAT 3.15p). ** Test 2: Lines "[1]" and "[2]" are swapped. Now the large memory leak of the test program is confirmed. ObjectAda: 47.8MB, N=20,000 GNAT 3.15: 20.7MB, N=20,000, "-largs --stack=0x40000,0x8000". Craig Carey ; Ada 95 mailing lists htp://www.ijs.co.nz/ada_95.htm