From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,STOX_REPLY_TYPE, STOX_REPLY_TYPE_WITHOUT_QUOTES,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a575249b5f286bfe,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.129.169 with SMTP id nx9mr1690479pbb.2.1334319324660; Fri, 13 Apr 2012 05:15:24 -0700 (PDT) Path: r9ni51452pbh.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!feed.xsnews.nl!border-1.ams.xsnews.nl!post-feeder-02.xsnews.nl!frontend-F10-14.ams.news.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada Subject: Garbage Collection ??? Date: Fri, 13 Apr 2012 14:14:43 +0200 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Message-ID: <4f881910$0$2652$703f8584@news.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1334319376 news.kpn.nl 2652 77.168.179.107@kpn/77.168.179.107:50096 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Date: 2012-04-13T14:14:43+02:00 List-Id: I am creating a program within GNAT Programming Studio in which I have to create A List of the model edges : ptr_Node; where ptr_Node is ..... ..... next : ptr_edge; end record; This structure is called throughout my program extensively with no problems but within a declare begin ... end part of the form declare stold_Points : ptr_Node; old_Points : ptr_Node; begin stold_Points := new Node; ... ... end; This program part is run within a while loop. Now the following occurs: I get a segmentation fault on line 196 within the program lines: edges := stedges; while edges /= NULL loop Edge_Force(edges); line 196 edges := edges.next; end loop; with the fault message: Program received signal SIGSEGV, Segmentation fault. 0x0054694c in falling.falling_ball (file_name=..., version=...) at E:\ada\project\Cell_3D\Source Files\Falling.adb:196 At the point the program is stopped I get the following values printed (gdb) print stedges $9 = (access general.edge) 0x3e2dbf8 (gdb) print edges $8 = (access general.edge) 0x0 The fault is the result of the last result that is clear edges = NULL when edges.next is called but as the code of Edge_Force is procedure Edge_Force(edge1 : ptr_Edge) is len : float; begin 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; end Edge_Force; I don't change the value of edges so as I read it edges could not be NULL at that point. What also causes the changed value of edges within the loop. Can it be some garbage problem. At the moment the fault occurs the outer loop has run for at least serveral hundred times L. Dries