rchain / Rosette

8 stars 5 forks source link

Memory management issues in ess_bin #2

Open stprior opened 7 years ago

stprior commented 7 years ago

There appears to be a memory management issue in the C++ code, This may be responsible for segmentation faults, and errors like

loading: ./system.rbl silent  
*** runtime error:  
{StdOprn}  
"bad method"  
{Ctxt}  
#niv

Output from running "bin/ess_bin -boot rbl/rosette/boot.rbl" through valgrind is here

The issue may be from an array allocated using new void* [sz] h/ResizeAry.h and reallocated in src/ResizeAry.cc (mixing incompatible C++ and C memory routines).

stprior commented 7 years ago

Fix could be attempted by just using a vector instead of resizing an array. This would need to be done in the ResizeablePtrArray class and its subclasses (e.g. PtrQueue and PtrCollection). I started this here but only changed the base class so far.