On Fri, Nov 13, 2009 at 6:13 PM, Robert Kern <robert.k...@gmail.com> wrote: > On Fri, Nov 13, 2009 at 12:05, Travis Oliphant <oliph...@enthought.com> wrote: >> I wonder if this is related to the fact that you can't "unload" a >> dynamically linked module (like NumPy has). So, when you call >> Py_Finalize you are not really "finalizing" your usage of Python >> extension modules. >> >> I'm not sure though. > > Right. We do some global things when numpy is imported. Since there is > no unload step for extension modules, we can't undo them. The second > time the interpreter starts up, it doesn't know that numpy has already > been loaded and that numpy shouldn't try to do those global things > again.
Thanks for the quick responses... I'm sure you're right - in fact it looks like there was a similar issue here: http://www.mathworks.co.uk/matlabcentral/newsreader/view_thread/262089 I had assumed when matlab unloads the mex function it would also unload python - but it looks like other dynamic libs pulled in from the mex function (in this case python and in turn numpy) aren't unloaded... I wonder if it would be possible to link python statically to my mex function, so it really is unloaded when the mex function is... but I'm getting a bit out of my depth with linker options, and I guess numpy is always loaded dynamically anyway and will stick around. Easy enough to work around it anyway - but just wanted to check what was going on. Cheers Robin _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion