On Wed, 2003-07-30 at 18:23, Majorinc, Kazimir wrote:
> I wrote the program that process graphs where each node is represented as 
> record containing two lists of other nodes. It seems there is some problem 
> with that concept. Here is the code that causes problem:
...
> 
> Compile and executed (on 9.3.2 version of Icon for Windows or on Unicon for 
> Windows - I think it is last version) it allocates ~37 000 nodes (records 
> double_list) and then suddenly crushes. Although 37 000 might look good 
> enough, it really isn't:
> 
> with very simple changes, for example, 'every 1 to 1' instead "every 1 to 
> 2" or deleting line "put(random_old_double...", program will happily 
> allocate 566 000 objects (in both cases), and even then, it will not crush 
> but hang attempting to write something on the disk, as typical for Windows. 
> Anycase, that is satisfactory. Note that in both cases, circular references 
> still exist, and even if "every 1 to 100" is used in combination with 
> single list, program still allocates 100 000+ records before it hangs.

What a fascinating problem!  I'm interested in seeing what the
explanation is...

I did a little instrumentation, using a slightly modified version
of the program, running with Unicon on Linux:

------------------------------------------------------------------
record double_list(sublist,superlist)

procedure main()

   first_double_list:=double_list([],[])
   List_of_lists:=[first_double_list]

   every j := seq(0) do {
       new_double_list:=double_list([],[])

       #every 1 to 1 do
       every 1 to 2 do
         {  random_old_double_list := ?List_of_lists #
            put(new_double_list.sublist, random_old_double_list)
            put(random_old_double_list.superlist, new_double_list)
         }
       put(List_of_lists,new_double_list)

       if j % 1000 = 0 then {
           write ("First ",j," are OK.")
           showSizes()
           }
    }
end

procedure showSizes()
   local l1,l2
   every put(l1 := [], &storage)
   every put(l2 := [], &regions)
   write("\tstatic : ",l1[1],"/",l2[1])
   write("\tstring : ",l1[2],"/",l2[2])
   write("\tblock  : ",l1[3],"/",l2[3])
end
-------------------------------------------------------------------------

With the code as above, the program ran through 118000+ iterations
before terminating (no error message, but with status 139 returned
[and running with Icon instead of Unicon produced a segmentation
fault at the same place.]) Last region sizes were:

First 118000 are OK.
        static : 0/0
        string : 0/500000
        block  : 31479876/31500000

replacing the 'every 1 to 2 do' with 'every 1 to 1 do' ran *at least*
1931000 iterations (long pause there for GC and I wasn't ready to
wait...).  Region sizes at that point were:

First 1931000 are OK.
        static : 0/0
        string : 0/500000
        block  : 511406048/511500000

So it's clearly not a problem with running out of heap.


-- 
Steve Wampler <[EMAIL PROTECTED]>


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to