473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Py_DECREF/Py_INCREF as Functions?

I'm trying to use Python from another application that allows me to
load functions from a DLL. While I have most of the API working, I
have one big problem: Py_DECREF and PyINCREF are macros which I can't
load from the Python DLL. Since I can't decref any objects, I'm
leaking memory all over the place. Is there any way to decref an
object with a function that can be loaded from the Python DLL?

--
Kevin D. Smith

Mar 30 '07 #1
1 2006
En Fri, 30 Mar 2007 20:21:53 -0300, Kevin D.Smith <Ke*********@sas.com>
escribió:
I'm trying to use Python from another application that allows me to
load functions from a DLL. While I have most of the API working, I
have one big problem: Py_DECREF and PyINCREF are macros which I can't
load from the Python DLL. Since I can't decref any objects, I'm
leaking memory all over the place. Is there any way to decref an
object with a function that can be loaded from the Python DLL?
Yes. Usually the macro has an ALLCAPS name and the function a TitleCase
name. See Py_IncRef and Py_DecRef in object.c

--
Gabriel Genellina

Mar 31 '07 #2

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

Similar topics

5
by: hokiegal99 | last post by:
A few questions about the following code. How would I "wrap" this in a function, and do I need to? Also, how can I make the code smart enough to realize that when a file has 2 or more bad...
99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
2
by: Torsten Mohr | last post by:
Hi, when i write an extension module in C and return a Py_Object* that i've built with Py_BuildValue, do i need to use Py_INCREF on that before i return it to python from my extension module or...
2
by: Jeremy Moles | last post by:
When I add an object created locally to a mapping or sequence (that will be returned from a function into an running instance of the Python interpreter), I need to call Py_DECREF on the object,...
2
by: seberino | last post by:
I would think everytime you add an item to a list you must increase reference count of that item. http://docs.python.org/api/refcountDetails.html has an example that seems to contradict...
1
by: seberino | last post by:
PyList_Append requires explicit Py_INCREF after? (I didn't see in docs where it said if appends a new reference or a borrowed reference like other APIs.) thanks! Chris
0
by: Hrvoje =?UTF-8?Q?Nik=C5=A1i=C4=87?= | last post by:
I'm wondering what happens with the exception info during object cleanup immediately after an exception is thrown. Consider this code: PyObject *args = PyBuild_Value("(O(O){})", name, parent);...
1
by: yuri.feldman | last post by:
Hello, I'm embedding Python interpreter in a Win32 console application. I use C++. I would like to use the WinAPI LoadLibrary function to load the python dll at runtime (followed by...
7
by: Immortal Nephi | last post by:
My project grows large when I put too many member functions into one class. The header file and source code file will have approximately 50,000 lines when one class contains thousand member...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.