> On 6 Apr 2017, at 10:39, Denis Kudriashov <dionisi...@gmail.com> wrote:
> 
> 
> 2017-04-06 10:37 GMT+02:00 Denis Kudriashov <dionisi...@gmail.com 
> <mailto:dionisi...@gmail.com>>:
> But then the problem is on "how to not lose your code", not in FFI... 
> 
> Restarting image is a problem. For any other "smalltalk" problems we got 
> suitable debugger but not in that case.
> 
> Also when image crashed we need to recover all objects state for the script 
> which produce crash

FFI is a border.
Once you start working with it, you are in C world. 
And C world is nasty, hard and cumbersome.

In C world, pointers not correctly alloc’d produce a crash. 
In C world, pointers not correctly freed also produce a crash, eventually (and 
those are harder to fix). 
In C world everything pointing to wrong location will produce a crash (and you 
can point anything to anywhere). 

That’s why garbage collectors were invented, after all. 

So my only advice here is: 

- recheck all your allocs/free, rigorously
- save your image before test
- be sure epicea is working 

Finally, I would say the only way to prevent your image to crash is to not 
execute FFI calls inside it. To do this, you can always use ImageWorker 
(http://smalltalkhub.com/#!/~PharoExtras/ImageWorker) to actually execute your 
tests in a different execution. Yes is slow, but it will be safer. 

Esteban

Reply via email to