Boost logo

Boost Users :

From: Dirk Gerrits (yg-boost-users_at_[hidden])
Date: 2003-05-15 13:09:24


dima_mouromtsev wrote:
> Hello All!

Hi.

> I've the problem with the next code:
>
[snip]
>
> When I start this code, that's all right.
>
> If I move Py_Finalize() to destructor, the program work, but when I
> close the program an exeption rise (Py_FatalError("UNREF invalid
> object")).
>
> Next, I exclude Boost classes:
>
[snip]
>
> So the program work well and there is no exeptions at exit.
>
> What is my problem? How can I use Boost in right way?

I haven't been able to reproduce your problem with Boost 1.30.0, but I
have run into a similar problem in the past. The cause is that
Boost.Python contains a few global and static Python objects, which get
destructed after the program ends. Since you call Py_Finalize() before
the end of the program, Python has already shutdown and released these
objects, which causes the problem.

This is of course a bug in Boost.Python. Dave and I are trying to fix it
soon, but for now, you should just not call Py_Finalize. This means your
program might leak some memory, but this should be reclaimed by your
operating system anyway.

Hope that helps,

Dirk Gerrits


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net