comp.lang.ada
 help / color / mirror / Atom feed
From: reason67@my-deja.com
Subject: Re: Apex vs GNAT on solaris
Date: 1999/12/07
Date: 1999-12-07T00:00:00+00:00	[thread overview]
Message-ID: <82hk18$7up$1@nnrp1.deja.com> (raw)
In-Reply-To: 82hiuj$74o$1@nnrp1.deja.com


>       3.0 mem map of allocation of 1 .. 1 meg of memory keeping 1
> previous allocation

-=-=-=-=-=-=-=-

with Ada.Text_Io;
with Ada.Unchecked_Deallocation;

with Common_Utilities;
with System;
with System.Address_To_Access_Conversions;
with System.Storage_Elements;
use type System.Storage_Elements.Integer_Address;


procedure Aaaa_3_0_Malloc is
    type Byte is mod 256;

    subtype Index_Type is Integer range 0 .. 1048476;
    type Byte_Array_Type is array (Index_Type range <>) of Byte;

    package Converter is
       new System.Address_To_Access_Conversions (Byte_Array_Type);

    procedure Free is new Ada.Unchecked_Deallocation
                             (Byte_Array_Type,
Converter.Object_Pointer);


    Current : Converter.Object_Pointer;
    Last : Converter.Object_Pointer;
--    Address : System.Address;
    Address : System.Storage_Elements.Integer_Address;
    File : Ada.Text_Io.File_Type;

    function Create (Length : in Index_Type) return
Converter.Object_Pointer is
        Result : Converter.Object_Pointer;
    begin
        return new Byte_Array_Type (1 .. Length);
    end Create;

begin

    Ada.Text_Io.Create (File => File, Name => "3.0_malloc_apex");

    Current := Create (1);

    Address := System.Storage_Elements.To_Integer
                  (Converter.To_Address (Current));

    Ada.Text_Io.Put_Line
       (File,
        "1 " & Common_Utilities.Strip_Spaces
                  (System.Storage_Elements.Integer_Address'Image
(Address)) &
           " " & Common_Utilities.Strip_Spaces
                    (System.Storage_Elements.Integer_Address'Image
(Address)));

    Last := Current;
    Current := Create (2);

    Address := System.Storage_Elements.To_Integer
                  (Converter.To_Address (Current));


    Ada.Text_Io.Put_Line
       (File,
        "2 " & Common_Utilities.Strip_Spaces
                  (System.Storage_Elements.Integer_Address'Image
(Address)) &
           " " & Common_Utilities.Strip_Spaces
                    (System.Storage_Elements.Integer_Address'Image
                        (Address + 1)));

    for Index in 3 .. Index_Type'Last loop

        Free (Last);
        Last := Current;
        Current := Create (Index);

        Address := System.Storage_Elements.To_Integer
                      (Converter.To_Address (Current));


        Ada.Text_Io.Put_Line
           (File,
            Common_Utilities.Strip_Spaces (Index_Type'Image (Index)) & "
" &
               Common_Utilities.Strip_Spaces
                  (System.Storage_Elements.Integer_Address'Image
(Address)) &
               " " &
               Common_Utilities.Strip_Spaces
                  (System.Storage_Elements.Integer_Address'Image
                      (Address +
                       System.Storage_Elements.Integer_Address (Index) -
1)));

    end loop;

    Ada.Text_Io.Close (File);

end Aaaa_3_0_Malloc;

-=-=-=-=-=-=-=-=-=-=-

This produces alot of output. I graphed it and found that both Apex and
GNAT did a good job of memory management on solaris


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~1999-12-07  0:00 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-07  0:00 Apex vs GNAT on solaris reason67
1999-12-07  0:00 ` reason67
1999-12-07  0:00 ` reason67
1999-12-07  0:00   ` Robert Dewar
1999-12-07  0:00     ` Vladimir Olensky
1999-12-07  0:00       ` Vladimir Olensky
1999-12-09  0:00       ` Geoff Bull
1999-12-09  0:00         ` Vladimir Olensky
1999-12-10  0:00           ` Vladimir Olensky
1999-12-09  0:00         ` Vladimir Olensky
1999-12-07  0:00     ` reason67
1999-12-08  0:00       ` Robert Dewar
1999-12-08  0:00         ` reason67
1999-12-07  0:00 ` reason67 [this message]
1999-12-07  0:00   ` Robert Dewar
1999-12-07  0:00     ` reason67
1999-12-07  0:00 ` reason67
1999-12-07  0:00 ` reason67
1999-12-07  0:00 ` reason67
1999-12-07  0:00 ` Robert Dewar
1999-12-07  0:00   ` Roger Racine
1999-12-07  0:00     ` David Starner
1999-12-08  0:00       ` Robert Dewar
1999-12-07  0:00     ` Jean-Pierre Rosen
1999-12-07  0:00     ` Samuel T. Harris
1999-12-07  0:00     ` Larry Kilgallen
1999-12-08  0:00     ` Robert Dewar
1999-12-08  0:00       ` Roger Racine
1999-12-08  0:00         ` Larry Kilgallen
1999-12-08  0:00           ` Roger Racine
1999-12-08  0:00             ` tmoran
1999-12-08  0:00             ` Larry Kilgallen
1999-12-09  0:00         ` Robert Dewar
1999-12-09  0:00           ` Roger Racine
1999-12-09  0:00             ` Mike Silva
1999-12-10  0:00               ` Robert Dewar
1999-12-09  0:00             ` Larry Kilgallen
1999-12-10  0:00               ` Robert Dewar
1999-12-16  0:00             ` Stefan Skoglund
1999-12-08  0:00       ` Robert A Duff
1999-12-08  0:00     ` Ted Dennison
1999-12-07  0:00   ` reason67
1999-12-08  0:00     ` Robert Dewar
1999-12-08  0:00       ` reason67
1999-12-08  0:00         ` Robert A Duff
1999-12-08  0:00         ` Robert Dewar
1999-12-08  0:00         ` Larry Kilgallen
1999-12-07  0:00 ` reason67
replies disabled

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