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,3d9b089555215fa7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada memory management seems slow Date: 12 Oct 2005 18:17:47 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1129155467 21992 192.74.137.71 (12 Oct 2005 22:17:47 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 12 Oct 2005 22:17:47 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:5567 Date: 2005-10-12T18:17:47-04:00 List-Id: "Makhno" writes: > Hello, > I have been given some Ada software to use, and it uses some linked list > structures. I compiled it using Win32 GNAT. > These structures are dynamically allocated, and when they are de-allocated, > it takes up a almost 2 seconds of computing time, even though this is a fast > PC and the actual memory they use doesn't appear to be much (seems less than > 1mb according to the task manager). > > I was wondering what options are available for memory management, or whether > I am inadvertently using a 'slow' mode. It's impossible to know what the problem is without looking at the source code. You can write your own storage management code -- look up package Storage_Pools in the RM. For example, you can arrange to deallocate large chunks of memory all at once, rather than deallocating each list element individually -- this is called "region based memory management" or "arena based memory management". Sometimes deallocation is triggered by finalization. This can be very convenient, but most compilers have quite a lot of run-time overhead for finalization, so that could be part of your problem. Finalizing a million objects could take a fairly long time. I believe there's a pragma in GNAT to turn off finalization if the program is about to exit anyway; I don't remember what it's called. - Bob