comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: Garbage Collection ???
Date: Fri, 13 Apr 2012 21:27:23 +0200
Date: 2012-04-13T21:27:23+02:00	[thread overview]
Message-ID: <4f888010$0$2641$703f8584@news.kpn.nl> (raw)
In-Reply-To: <5o86o2smbjpz.17l849bmku28v$.dlg@40tude.net>

I have been trying to find the place where a faulty pointer could have been 
introduced and I come to the conclusion that the return of a procedure in 
the place.
I did position some variables (edge_debug1 till edge_debug4) to be filled 
with the value of the original pointer at various places in and around the 
procedure Edge_Force and printed them after the breakpoint.
The code there is now:

while edges /= NULL loop
   edge_debug3 := edges;
   Edge_Force(edges);
   edge_debug4 := edges;
   edges := edges.next;
end loop;

where Edge_Force code is:

procedure Edge_Force(edge1 : ptr_Edge) is
   len : float;
begin
   edge_debug1 := edge1;
   len := Length(edge1.P1.pnt, edge1.P2.pnt) - edge1.l_init;
   if abs(len / edge1.l_init) < 0.00001 then
     len := 0.0;
   end if;
   edge1.force := edge1.k_s * len;
   edge_debug2 := edge1;
end Edge_Force;

(gdb) print stedges
$43 = (access general.edge) 0x3e0d568

(gdb) print edges
$45 = (access general.edge) 0x0

(gdb) print edge_debug3
$48 = (access general.edge) 0x3db8200

(gdb) print edge_debug1
$51 = (access general.edge) 0x3db8200

(gdb) print edge_debug2
$53 = (access general.edge) 0x3db8200

(gdb) print edge_debug4
$55 = (access general.edge) 0x0
It can be seen that only the end of the procedure Edge_Force is between the 
creation of edge_debug2 and edge_debug4
The reason that I originally thought about Garbage collection is that I 
imagined that perhaps use of too much memory could be the reason.

Regards,
L. Dries

"Dmitry A. Kazakov"  schreef in bericht 
news:5o86o2smbjpz.17l849bmku28v$.dlg@40tude.net...

On Fri, 13 Apr 2012 14:14:43 +0200, ldries46 wrote:

> What also causes the changed value of edges within the loop. Can it be 
> some
> garbage problem.

(Fortunately, Ada does not have mandated GC). Most likely you have a
dangling pointer somewhere.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de 




  reply	other threads:[~2012-04-13 19:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 12:14 Garbage Collection ??? ldries46
2012-04-13 13:20 ` Dmitry A. Kazakov
2012-04-13 19:27   ` ldries46 [this message]
2012-04-13 20:06     ` Dmitry A. Kazakov
2012-04-13 22:49     ` Brian Drummond
2012-04-14  3:21       ` ldries46
2012-04-14 18:21         ` Robert A Duff
2012-04-18  9:07           ` Julian Leyh
2012-04-19 14:36             ` Robert A Duff
2012-04-19 20:26               ` Randy Brukardt
2012-04-20  7:11                 ` Dmitry A. Kazakov
2012-04-21  0:46                   ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
1992-04-22 18:55 Garbage collection? dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!yale.edu!jvnc.net!darw
1992-04-21 23:48 Robert I. Eachus
1992-04-21 23:02 Rick Hudson
1992-04-21 21:09 titan.ksc.nasa.gov!mcroberts
replies disabled

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