Memory error in python with QuantLib.Date()

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Memory error in python with QuantLib.Date()

Richard Stanton
I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my Mac
(OS X 10.8.4 running gcc 4.7.3), both installations apparently proceeding
without a hitch. However, I get a memory allocation error when I run the
command QuantLib.Date() in python. Here's an example:



In [2]: import QuantLib

In [3]: QuantLib.Date(5,5,2013)
python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Out[3]: Abort trap: 6

Any idea what's wrong?


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Luigi Ballabio
Hmm. That's the first I hear of it. People, is anybody else on the
list having the same problem?

Thanks,
    Luigi

On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton
<[hidden email]> wrote:

> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my Mac
> (OS X 10.8.4 running gcc 4.7.3), both installations apparently proceeding
> without a hitch. However, I get a memory allocation error when I run the
> command QuantLib.Date() in python. Here's an example:
>
>
>
> In [2]: import QuantLib
>
> In [3]: QuantLib.Date(5,5,2013)
> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
> pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Out[3]: Abort trap: 6
>
> Any idea what's wrong?
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Richard Stanton
I get the same problem with 1.3 using this compiler.

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, July 3, 2013 1:01 AM
To: Richard Stanton
Cc: [hidden email]
Subject: Re: [Quantlib-users] Memory error in python with QuantLib.Date()

Hmm. That's the first I hear of it. People, is anybody else on the list having the same problem?

Thanks,
    Luigi

On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton <[hidden email]> wrote:

> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
> proceeding without a hitch. However, I get a memory allocation error
> when I run the command QuantLib.Date() in python. Here's an example:
>
>
>
> In [2]: import QuantLib
>
> In [3]: QuantLib.Date(5,5,2013)
> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
> pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Out[3]: Abort trap: 6
>
> Any idea what's wrong?
>
>
> ----------------------------------------------------------------------
> -------- This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Luigi Ballabio
You said it works with clang? What was Python itself built with?

Luigi

On Thu, Jul 4, 2013 at 3:57 PM, Richard Stanton
<[hidden email]> wrote:

> I get the same problem with 1.3 using this compiler.
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Wednesday, July 3, 2013 1:01 AM
> To: Richard Stanton
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] Memory error in python with QuantLib.Date()
>
> Hmm. That's the first I hear of it. People, is anybody else on the list having the same problem?
>
> Thanks,
>     Luigi
>
> On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton <[hidden email]> wrote:
>> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
>> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
>> proceeding without a hitch. However, I get a memory allocation error
>> when I run the command QuantLib.Date() in python. Here's an example:
>>
>>
>>
>> In [2]: import QuantLib
>>
>> In [3]: QuantLib.Date(5,5,2013)
>> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>> Out[3]: Abort trap: 6
>>
>> Any idea what's wrong?
>>
>>
>> ----------------------------------------------------------------------
>> -------- This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Richard Stanton
I'm not sure. I'm using the Anaconda python distribution if that helps.

I haven't had any other trouble using this same compiler for all of my cython code, but maybe this makes fewer demands on the memory allocation side of things.

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Thursday, July 4, 2013 2:19 PM
To: Richard Stanton
Cc: [hidden email]
Subject: Re: [Quantlib-users] Memory error in python with QuantLib.Date()

You said it works with clang? What was Python itself built with?

Luigi

On Thu, Jul 4, 2013 at 3:57 PM, Richard Stanton <[hidden email]> wrote:

> I get the same problem with 1.3 using this compiler.
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Wednesday, July 3, 2013 1:01 AM
> To: Richard Stanton
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] Memory error in python with
> QuantLib.Date()
>
> Hmm. That's the first I hear of it. People, is anybody else on the list having the same problem?
>
> Thanks,
>     Luigi
>
> On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton <[hidden email]> wrote:
>> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
>> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
>> proceeding without a hitch. However, I get a memory allocation error
>> when I run the command QuantLib.Date() in python. Here's an example:
>>
>>
>>
>> In [2]: import QuantLib
>>
>> In [3]: QuantLib.Date(5,5,2013)
>> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>> Out[3]: Abort trap: 6
>>
>> Any idea what's wrong?
>>
>>
>> ---------------------------------------------------------------------
>> -
>> -------- This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>
> ----------------------------------------------------------------------
> -------- This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Richard Stanton
In reply to this post by Luigi Ballabio
Upgrading to gcc 4.8, I don't get this error any more.

Richard


On 7/4/13 2:18 PM, "Luigi Ballabio" <[hidden email]> wrote:

>You said it works with clang? What was Python itself built with?
>
>Luigi
>
>On Thu, Jul 4, 2013 at 3:57 PM, Richard Stanton
><[hidden email]> wrote:
>> I get the same problem with 1.3 using this compiler.
>>
>> -----Original Message-----
>> From: Luigi Ballabio [mailto:[hidden email]]
>> Sent: Wednesday, July 3, 2013 1:01 AM
>> To: Richard Stanton
>> Cc: [hidden email]
>> Subject: Re: [Quantlib-users] Memory error in python with
>>QuantLib.Date()
>>
>> Hmm. That's the first I hear of it. People, is anybody else on the list
>>having the same problem?
>>
>> Thanks,
>>     Luigi
>>
>> On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton
>><[hidden email]> wrote:
>>> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
>>> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
>>> proceeding without a hitch. However, I get a memory allocation error
>>> when I run the command QuantLib.Date() in python. Here's an example:
>>>
>>>
>>>
>>> In [2]: import QuantLib
>>>
>>> In [3]: QuantLib.Date(5,5,2013)
>>> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
>>> pointer being freed was not allocated
>>> *** set a breakpoint in malloc_error_break to debug
>>> Out[3]: Abort trap: 6
>>>
>>> Any idea what's wrong?
>>>
>>>
>>> ----------------------------------------------------------------------
>>> -------- This SF.net email is sponsored by Windows:
>>>
>>> Build for Windows Store.
>>>
>>> http://p.sf.net/sfu/windows-dev2dev
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>>
>>
>> --
>> <https://implementingquantlib.blogspot.com>
>> <https://twitter.com/lballabio>
>>
>>
>>-------------------------------------------------------------------------
>>-----
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
>--
><https://implementingquantlib.blogspot.com>
><https://twitter.com/lballabio>


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Luigi Ballabio

Glad to hear it. I didn't even know where to start with this one...

Luigi

On Jul 6, 2013 4:38 AM, "Richard Stanton" <[hidden email]> wrote:
Upgrading to gcc 4.8, I don't get this error any more.

Richard


On 7/4/13 2:18 PM, "Luigi Ballabio" <[hidden email]> wrote:

>You said it works with clang? What was Python itself built with?
>
>Luigi
>
>On Thu, Jul 4, 2013 at 3:57 PM, Richard Stanton
><[hidden email]> wrote:
>> I get the same problem with 1.3 using this compiler.
>>
>> -----Original Message-----
>> From: Luigi Ballabio [mailto:[hidden email]]
>> Sent: Wednesday, July 3, 2013 1:01 AM
>> To: Richard Stanton
>> Cc: [hidden email]
>> Subject: Re: [Quantlib-users] Memory error in python with
>>QuantLib.Date()
>>
>> Hmm. That's the first I hear of it. People, is anybody else on the list
>>having the same problem?
>>
>> Thanks,
>>     Luigi
>>
>> On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton
>><[hidden email]> wrote:
>>> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
>>> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
>>> proceeding without a hitch. However, I get a memory allocation error
>>> when I run the command QuantLib.Date() in python. Here's an example:
>>>
>>>
>>>
>>> In [2]: import QuantLib
>>>
>>> In [3]: QuantLib.Date(5,5,2013)
>>> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
>>> pointer being freed was not allocated
>>> *** set a breakpoint in malloc_error_break to debug
>>> Out[3]: Abort trap: 6
>>>
>>> Any idea what's wrong?
>>>
>>>
>>> ----------------------------------------------------------------------
>>> -------- This SF.net email is sponsored by Windows:
>>>
>>> Build for Windows Store.
>>>
>>> http://p.sf.net/sfu/windows-dev2dev
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>>
>>
>> --
>> <https://implementingquantlib.blogspot.com>
>> <https://twitter.com/lballabio>
>>
>>
>>-------------------------------------------------------------------------
>>-----
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
>--
><https://implementingquantlib.blogspot.com>
><https://twitter.com/lballabio>


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Memory error in python with QuantLib.Date()

Richard Stanton
Unfortunately, it's not quite as easy as I thought.

I use the Anaconda python distribution on my machine. If I compile and install Quantlib and the Python SWIG bindings using gcc 4.8.1, I do get the same memory error when I try to run QuantLib.Date() unless I first set the environment variable

DYLD_LIBRARY_PATH=/opt/local/lib

With this variable set, QuantLib.Date() runs fine. I turned on some debugging information, fired up ipython, loaded QuantLib, and ran QuantLib.Date() with and without this variable set, and found that setting this variable causes different versions of several libraries to be loaded, in particular,

libpython2.7.dylib
libz.1.dylib
libstdc++.6.dylib
libsqlite3.0.dylib
libreadline.6.2.dylib
libncurses.5.dylib

This seems pretty clearly relevant, but I don't really want to set this environment variable as it results in loading several libraries that are not Anaconda-related (especially libpython2.7.dylib). In particular, when I start python at the command line, it announces itself as 

Richards-Mac-Pro:ESOest stanton$ python
Python 2.7.5 (default, May 19 2013, 13:26:46) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.

rather than the usual

Richards-Mac-Pro:ESOest stanton$ python
Python 2.7.5 |Anaconda 1.6.0 (x86_64)| (default, May 31 2013, 10:42:42) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

even though "which python" tells me it's going to run the anaconda version in both cases.

This doesn't seem like a good idea in general, and more specifically it causes big problems with some other Python-related installations. For example, hg refuses to run at all with this environment variable set.

Anyone have any suggestions here?

Thanks.

Richard Stanton



From: "'luigi. com'" <[hidden email]>
Date: Saturday, July 6, 2013 1:53 AM
To: Richard Stanton <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Subject: Re: [Quantlib-users] Memory error in python with QuantLib.Date()

Glad to hear it. I didn't even know where to start with this one...

Luigi

On Jul 6, 2013 4:38 AM, "Richard Stanton" <[hidden email]> wrote:
Upgrading to gcc 4.8, I don't get this error any more.

Richard


On 7/4/13 2:18 PM, "Luigi Ballabio" <[hidden email]> wrote:

>You said it works with clang? What was Python itself built with?
>
>Luigi
>
>On Thu, Jul 4, 2013 at 3:57 PM, Richard Stanton
><[hidden email]> wrote:
>> I get the same problem with 1.3 using this compiler.
>>
>> -----Original Message-----
>> From: Luigi Ballabio [mailto:[hidden email]]
>> Sent: Wednesday, July 3, 2013 1:01 AM
>> To: Richard Stanton
>> Cc: [hidden email]
>> Subject: Re: [Quantlib-users] Memory error in python with
>>QuantLib.Date()
>>
>> Hmm. That's the first I hear of it. People, is anybody else on the list
>>having the same problem?
>>
>> Thanks,
>>     Luigi
>>
>> On Tue, Jul 2, 2013 at 11:19 PM, Richard Stanton
>><[hidden email]> wrote:
>>> I installed Quantlib (1.2.1) and the SWIG python bindings (1.2) on my
>>> Mac (OS X 10.8.4 running gcc 4.7.3), both installations apparently
>>> proceeding without a hitch. However, I get a memory allocation error
>>> when I run the command QuantLib.Date() in python. Here's an example:
>>>
>>>
>>>
>>> In [2]: import QuantLib
>>>
>>> In [3]: QuantLib.Date(5,5,2013)
>>> python(86338,0x7fff7babb180) malloc: *** error for object 0x109f3c840:
>>> pointer being freed was not allocated
>>> *** set a breakpoint in malloc_error_break to debug
>>> Out[3]: Abort trap: 6
>>>
>>> Any idea what's wrong?
>>>
>>>
>>> ----------------------------------------------------------------------
>>> -------- This SF.net email is sponsored by Windows:
>>>
>>> Build for Windows Store.
>>>
>>> http://p.sf.net/sfu/windows-dev2dev
>>> _______________________________________________
>>> QuantLib-users mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>>
>>
>> --
>> <https://implementingquantlib.blogspot.com>
>> <https://twitter.com/lballabio>
>>
>>
>>-------------------------------------------------------------------------
>>-----
>> This SF.net email is sponsored by Windows:
>>
>> Build for Windows Store.
>>
>> http://p.sf.net/sfu/windows-dev2dev
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
>
>--
><https://implementingquantlib.blogspot.com>
><https://twitter.com/lballabio>


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users