Command: testsuite::test_dict_basic_self_reference

NEST HelpDesk Command Index NEST Quick Reference

Name:
 testsuite::test_dict_basic_self_reference - sli script to test self reference of dictionaries

Synopsis:
 (test_dict_basic_self_reference.sli) run

Description:
   test_dict_basic_self_reference checks whether a dictionary with a first level self-references is 
   correctly destructed.

   In SLI dictionaries are reference counted objects. Copying a dictionary means copying the pointer
   and providing another reference to the same object. If the contents of the dictionary is changed,
   the object remains the same and the change is visible from all references to the object. This behavior
   is unlike the behavior of arrays which are also reference counted but are immediately cloned if the 
   contents is changed via one of the references. Therefore the change to an array from one reference
   is never visible from other potential references. The behavior of arrays is sometimes called "lazy copy".

   As a consequence of these definitions, dictionaries may contain references to themselves which we call
   self references. When a dictionary is destroyed special care needs to be taken to handle the self references
   correctly. Revisions of NEST prior to r10990 where not handling this correctly and causing a memory 
   leak. The memory leak can be exposed by the following lines 
       ulimit -v $((1024*1024))  
       SLI ] {<< /d 0 >> dup begin /d exch def end} loop
   which quickly exhausts the provided memory. This demonstration of the memory leak was provided by 
   Alexander Peyser in April 2014. It is possible that early versions of the SLI interpreter contained 
   code to handle recursive dictionary definitions which got lost over the years.
   

FirstVersion:
 April 2014
Author:
 Diesmann
SeeAlso:references selfreferences testsuite::test_spike_generator
Source:
 /home/abuild/rpmbuild/BUILD/nest-2.4.1/testsuite/unittests/test_dict_basic_self_reference.sli

NEST HelpDesk Command Index NEST Quick Reference

© 2000-2010 The NEST Initiative