comp.lang.ada
 help / color / mirror / Atom feed
From: Mats.Weber@elca-matrix.ch (Mats Weber)
Subject: Re: Memory leak in porting VAX/VMS -> AXP/VMS
Date: 1996/04/11
Date: 1996-04-11T00:00:00+00:00	[thread overview]
Message-ID: <Mats.Weber-1104961855500001@mlma21.elca-matrix.ch> (raw)
In-Reply-To: Mats.Weber-0904962310310001@mlma21.elca-matrix.ch

We just found the memory leak. It was in a function that converts a binary
tree into an array, something like:

      function Equiv (L : Link) return List is
      begin
         if L = null then
            declare

               Null_List : List(1..0);

            begin
               return Null_List;
            end;
         else
            if Key_Of(Item) < Key_Of(L.Val) then
               return Equiv(L.Left);
            elsif Key_Of(Item) = Key_Of(L.Val) then
               if Equal(Item, L.Val) then
                  return Equiv(L.Left) & L.Val & Equiv(L.Right);
               else
                  return Equiv(L.Left) & Equiv(L.Right);
               end if;
            else
               return Equiv(L.Right);
            end if;
         end if;
      end Equiv;

which was in a generic that was instantiated with a type with
discriminants. I changed the code to remove the combination of "&" and
recursion and now it doesn't leak memory anymore. I haven't yet tried
version 3.3 of the VMS/AXP compiler to see if the bug has gone.

Thanks to all those who answered.




  parent reply	other threads:[~1996-04-11  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-09  0:00 Memory leak in porting VAX/VMS -> AXP/VMS Mats Weber
1996-04-09  0:00 ` Chet
1996-04-10  0:00 ` Rick Gillmore
1996-04-11  0:00 ` Mats Weber [this message]
1996-04-11  0:00 ` Larry Kilgallen
replies disabled

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