comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: Ada memory management seems slow
Date: Fri, 14 Oct 2005 16:49:54 +0200
Date: 2005-10-14T16:49:54+02:00	[thread overview]
Message-ID: <2697069.RuJ6LmJjQa@linux1.krischik.com> (raw)
In-Reply-To: dim9ob$o7b$1@news6.svr.pol.co.uk

Makhno wrote:

>> GNAT uses malloc and free from the C library  for memory management - so
>> performace is the same as with C. Only with C nobody measures the
>> performance - people just expect malloc and free to be as fast as
>> possible.
> 
> I find this difficult to believe - I have experience of using free() in C,
> and unless the lists are far bigger than I think they are, C is nowhere
> near as slow as this.

Do you use Ada.Finalization? Ada.Finalization can eat performace when
compared with C. C does not have automatic finalisation.

> Is there any way I can check precisely what Ada is using? The program is
> calling something called FREE which is defined as some sort of deallocator
> called Ada.Unchecked_Deallocation

You can look up the source code. From you installation directory you should
have something like:

.../lib/gcc/x86_64-unknown-linux-gnu/3.4.5/adainclude

Where you find almost the full sources for all gnat library functions. Look
at s-crtl.ads where the actual malloc call is.

>>> I was wondering what options are available for memory management, or
>>> whether I am inadvertently using a 'slow' mode.
>>
>> Well there is indeed a memory debug option - but its off by default.
> 
> I'm using gnatmake with -O3.

In which case GNAT will automaticy inline if possible - using the sources
mentioned above ;-)

Well, I have a cold - maybe someone else can elaborate on finalisation.

Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



  parent reply	other threads:[~2005-10-14 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-12 21:49 Ada memory management seems slow Makhno
2005-10-12 22:17 ` Robert A Duff
2005-10-13  1:39   ` Anh Vo
2005-10-13 16:39 ` Martin Krischik
2005-10-13 18:39   ` Makhno
2005-10-14  9:59     ` Alex R. Mosteo
2005-10-14 10:38       ` Martin Dowie
2005-10-14 12:06         ` Stephen Leake
2005-10-14 19:21         ` Gautier Write-only
2005-10-15 10:32           ` Georg Bauhaus
2005-10-15 11:10             ` Simon Wright
2005-10-14 19:34       ` tmoran
2005-10-14 14:49     ` Martin Krischik [this message]
2005-10-16  0:40     ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox