473,805 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Py_Finalize

Hi,
I embeded Python in a C++ application to support some scripts. I start it
using Py_Initialize() and after using running the scripts I call
Py_Finalize(). The problem that I experienced is that the memory usage of
the process doesn't decrease after the Py_Finalize().
If I call again Py_Initialize() and then load some modules, the memory usage
increase, but it never decrease when calling Py_Finalize().
How can I do a complete cleanup of the python heap?

Thanks on advanced,

Pablo Yabo

Jul 18 '05 #1
0 1318

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2333
by: Kari Hallfast | last post by:
Hi, I'm a C++ programmer and I have just recently decided to use Python as an embedded scripting language. I call Py_Initialize(), run a few scripts and call PyFinalize() which causes an unhandled exception. My C++ program is a debug version and I tried using the debug and release versions of the python libs and dlls with the same results. I uninstalled Python 2.3 and installed 2.2.3 and everything works fine. I'm either not doing someting...
1
2954
by: Jerald | last post by:
Running python 2.3.4 on valgrind (a tool like purify which checks the use of uninitialized memory, etc), gives a lot of errors. See below. jfj@cluster:~/> python -V Python 2.3.4 jfj@cluster:~/> valgrind python ==10517== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
0
1199
by: Roman Suzi | last post by:
In pure curiosity I tried to compile loop.c from Demo/embed and started it with 'print 2+2'. It seems, that both 2.3 and 2.4 pythons have memory leaks in Py_Initialize/Py_Finalize calls. (That is, interpreter doesn't clean up well after itself). This is my setup: gcc -fpic loop.c -DHAVE_CONFIG_H -lm -lpython2.4 \ -lpthread -lutil -ldl \ -I/usr/local/include/python2.4 \
3
2634
by: brobigi | last post by:
well I manage to figure it out myself. I'm using Bloodshed Dev-cpp Here's the code: #include "python.h" #include <stdio.h> int main(int argc, char* argv) { double answer = 0;
0
2403
by: Andrew Trevorrow | last post by:
Hi folks, I've only been using Python for a few weeks, so please be gentle. :) Lovely language by the way -- I really enjoying using it -- but I've struck a very nasty problem when running Python scripts from my app. Summary: Multiple Py_Initialize/Py_Finalize calls result in bad memory leaks,
10
5675
by: Andrew Trevorrow | last post by:
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. Preferably an open source app so I can see how it's done. Our app (http://golly.sourceforge.net/) currently uses calls like these every...
0
995
by: Ben Sizer | last post by:
Here's my test-case: #include <python.h> int main(int argc, char *argv) { Py_Initialize(); Py_Finalize(); Py_Initialize(); Py_Finalize(); Py_Initialize(); Py_Finalize(); Py_Initialize(); Py_Finalize(); Py_Initialize(); Py_Finalize();
1
3054
by: zaley | last post by:
Py_Finalize ERROR! In my C++ program ,python is embeded . I create one win thread to run embedded Python code . So at the begin of thread function I call "Py_Initialize" and at the end of thread function call "Py_Finalize" . But after I began thread several times,the program crashed in function "Py_Finalize". I can see the error occured at function "PyObject_ClearWeakRefs" when "Py_Finalize" called "type_dealloc";
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10356
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10103
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5676
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.