Re: embedding Python: how to avoid memory leaks?

2006-03-10 Thread Wolfgang
Hallo, > >>> I couldn't get the PyRun_*File* calls to work on Windows, > >>> presumably because of the FILE* problem mentioned in the docs. > >> > >> Which compiler do you use? > > > > MSVC++ (version 6 from memory -- I do most of my development on > > the Mac and fire up Virtual PC occasionally t

Re: embedding Python: how to avoid memory leaks?

2006-03-10 Thread Martin v. Löwis
Torsten Bronger wrote: I couldn't get the PyRun_*File* calls to work on Windows, presumably because of the FILE* problem mentioned in the docs. > Well, I don't really *know*, but it's hard to believe to me that the > file descriptor format changed within the Microsoft product series. The

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Martin v. Löwis
Andrew Trevorrow wrote: > Surely that's a bug that should be fixed. There should be some way > to tell Python "release all the memory you've ever allocated and > start again with a clean slate". This bug cannot be fixed in any foreseeable future. > I've been told that the next version of Python

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Andrew Trevorrow
[EMAIL PROTECTED] wrote: > I could reproduce a memory leak with the code > > #include > int main() > { > while(1){ > Py_Initialize(); > PyRun_SimpleString("execfile('foo.py')"); > Py_Finalize(); > } > } > > However, I could not reproduce a memory leak with the code > > #include

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] (Andrew Trevorrow) writes: > Torsten Bronger <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] (Andrew Trevorrow) writes: >> >>> [...] >>> >>> I couldn't get the PyRun_*File* calls to work on Windows, >>> presumably because of the FILE* problem mentioned in the docs.

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Andrew Trevorrow
Torsten Bronger <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] (Andrew Trevorrow) writes: > > > [...] > > > > I couldn't get the PyRun_*File* calls to work on Windows, presumably > > because of the FILE* problem mentioned in the docs. > > Which compiler do you use? MSVC++ (version 6 from memory

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] (Andrew Trevorrow) writes: > [...] > > I couldn't get the PyRun_*File* calls to work on Windows, presumably > because of the FILE* problem mentioned in the docs. Which compiler do you use? Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetusICQ

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Martin v. Löwis
Andrew Trevorrow wrote: > Our app (http://golly.sourceforge.net/) currently uses calls > like these every time a user decides to run a script: > >Py_Initialize(); >PyRun_SimpleString("execfile('foo.py')"); >Py_Finalize(); > > But even if foo.py is *empty* the above calls result in a m

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Andrew Trevorrow
> > Our app (http://golly.sourceforge.net/) currently uses calls > > like these every time a user decides to run a script: > > > >Py_Initialize(); > >PyRun_SimpleString("execfile('foo.py')"); > > Does PyRun_AnyFile show the same effect? That's the way I'm about > to go. I couldn't get th

Re: embedding Python: how to avoid memory leaks?

2006-03-09 Thread Torsten Bronger
Hallöchen! Andrew Trevorrow <[EMAIL PROTECTED]> writes: > [...] > > [...] Not just once, but many times in a single session, and > without leaking memory. Preferably an open source app so I can > see how it's done. > > Our app (http://golly.sourceforge.net/) currently uses calls > like these ev

embedding Python: how to avoid memory leaks?

2006-03-09 Thread Andrew Trevorrow
No response to my last message, so I'll try a different tack... Does anyone know of, or even better, has anyone here written a C++ application for Mac/Windows that allows users to run Python scripts from within the app? Not just once, but many times in a single session, and without leaking memory