|
From: Luigi B. <lui...@gm...> - 2021-09-22 08:03:24
|
When you say
ext::shared_ptr<Matrix> ptr(&localVolMatrix);
in the wrapper, you're taking the address of an object with its own
lifetime and give it to a shared_ptr that will try to delete it. This
results in double deletion. You need to make a copy instead, as in
ext::shared_ptr<Matrix> ptr(new Matrix(localVolMatrix));
Hope this helps,
Luigi
On Mon, Sep 20, 2021 at 11:04 AM Ruilong Xu <xur...@ho...>
wrote:
> Hi,
>
> I am reimplementing hestonslvmodel.cpp by Python.
>
> SafeFdmMesherIntegral works well.
>
> But SafeFixedLocalVolSurface may cause error in testAMoustacheGraph, the
> following is what I get:
>
> double free or corruption (top)
> Backend terminated or disconnected.Fatal Python error: Aborted
>
>
>
> On Sep 20 2021, at 4:03 pm, Luigi Ballabio <lui...@gm...>
> wrote:
>
> Hello,
> shared_ptr should be supported correctly. How are you trying to wrap
> them?
>
> Luigi
>
>
> [image: Sent from Mailspring]
> On Fri, Sep 17, 2021 at 4:05 PM Ruilong Xu <xur...@ho...>
> wrote:
>
> Hi, all
>
> Some members of FdmMesherIntegral and FixedLocalVolSurface are shared_ptr,
> it means that Python GC will cause error in sometimes.
>
> Is there an easy and safe way to make Python wrappers of them by SWIG?
>
> Best Regards,
> Ruilong
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-usersdouble free or
> corruption (top)
> <https://lists.sourceforge.net/lists/listinfo/quantlib-users>
>
> Backend terminated or disconnected.Fatal Python error: Aborted
> <https://lists.sourceforge.net/lists/listinfo/quantlib-users>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|