comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada memory management seems slow
Date: 15 Oct 2005 20:40:09 -0400
Date: 2005-10-15T20:40:09-04:00	[thread overview]
Message-ID: <wccd5m6guqe.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: dim9ob$o7b$1@news6.svr.pol.co.uk

"Makhno" <root@127.0.0.1> writes:

> > 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.
> Is there any way I can check precisely what Ada is using?

You can dump out the assembly language produced by the compiler.
You can read the run-time library sources.
You can single-step through the code using gdb.

>...The program is
> calling something called FREE which is defined as some sort of deallocator 
> called Ada.Unchecked_Deallocation

Yeah, that's the usual way to deallocate things in Ada --
Unchecked_Deallocation is pretty-much analogous to free() in C.

I'm pretty sure Unchecked_Deallocation uses the same "free()" that C
code would use.  It's not very efficient (I've written more
efficient allocators), but it's not horrible.

What makes you think that memory deallocation is the problem?
Perhaps some other code is causing the problem.
I mentioned finalization in another post.
Also, Ada needs to do some locking around memory [de]allocation
primitives; that might be something to look into.

- Bob



      parent reply	other threads:[~2005-10-16  0:40 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
2005-10-16  0:40     ` Robert A Duff [this message]
replies disabled

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