Hello,
When debugging C extensions, I find the most difficult is to detect
that an object is Py_DECREF'ed when it should not.
And when you find yourself with an invalid object, it's a nightmare to
find where the error occured!
Normally tools like Purify are good to find this kind of memory
errors, but they are of no use with python's own memory allocator.
That's why I recompiled python (on Windows) in debug mode after
removing the WITH_PYMALLOC option.
This worked very well: Purify warned about a "Free memory read", and
it turned out that a custom sys.stdout was incorrectly DECREF'ed just
before, which caused the crash.
The problem is that this python build (debug/without-pymalloc) is not
compatible with extension modules built WITH_pymalloc. The DLL loader
fails with a "missing _PyObject_Debug Malloc" error.
Note that with release builds, extensions built with pymalloc are
compatible with python.dll built without pymalloc.
My workaround was to add the three functions (_PyObject_Debu gMalloc,
*Realloc and *Free) in obmalloc.c.
Isn't there another way?
Otherwise, should this be integrated in Python?
Thanks,
Amaury. 1 2408
"Amaury" <am*******@yaho o.com> writes: Hello,
When debugging C extensions, I find the most difficult is to detect that an object is Py_DECREF'ed when it should not. And when you find yourself with an invalid object, it's a nightmare to find where the error occured! Normally tools like Purify are good to find this kind of memory errors, but they are of no use with python's own memory allocator.
That's why I recompiled python (on Windows) in debug mode after removing the WITH_PYMALLOC option. This worked very well: Purify warned about a "Free memory read", and it turned out that a custom sys.stdout was incorrectly DECREF'ed just before, which caused the crash.
The problem is that this python build (debug/without-pymalloc) is not compatible with extension modules built WITH_pymalloc. The DLL loader fails with a "missing _PyObject_Debug Malloc" error. Note that with release builds, extensions built with pymalloc are compatible with python.dll built without pymalloc.
Hmm, that makes sense but I hadn't thought of it before. You could
also have recompiled the extensions, though.
My workaround was to add the three functions (_PyObject_Debu gMalloc, *Realloc and *Free) in obmalloc.c. Isn't there another way? Otherwise, should this be integrated in Python?
Possibly. Post a bug report or maybe a patch to SF if you feel
strongly about it...
Cheers,
mwh
--
If you don't use emacs, you're a pathetic, mewling, masochistic
weakling and I can't be bothered to convert you. -- Ron Echeverri This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Smith |
last post by:
Sorry if this is the wrong forum...
Does anyone know what the difference is between a debug build and an
optimised debug build in Visual Studio 2003?
|
by: emma middlebrook |
last post by:
I have a question regarding asserting ... here's some code:
string GetAssertMessage()
{
... prepare a message string and return it...
}
void SomeMethod()
{
...
|
by: babyx |
last post by:
The release build class library can only work with msvcr71d.dll and
msvcp71d.dll exist. How to make this class library work on any
machine without using the debug dlls? What are the project settings
that i need to take note so that it will become a "real" release
build without depending on the debug dll?
Can anybody help?
Posted Via Usenet.com Premium Usenet Newsgroup Services
|
by: Brian |
last post by:
Can sombody please outline the diference between setting complication mode
from the toolbar in VS.Net (i.e. debug/release) and setting the debug
attribute (i.e. true/false) on the compilation element in web.config.
What ts the difference?
Which one wins?
Which one should I use and When?
Thank You,
|
by: Boni |
last post by:
Dear all,
I have following problem. I created a static libruary (mylib.lib).
I compiled it with Multithreaded DLL runtime in release mode. Now I want to
give out this library. But users who use it should be able to debug their
programs (i.e. compile their programs in debug mode Multithreaded DLL DEBUG
runtime ).
But at link time following warning is shown and prog crashes. Do I have to
| |
by: William E Voorhees |
last post by:
I've just installed visual studio 2005. When I make code or form changes
and start debug (run program) my changes aren't seen unless I build the
program first. In 2003, I didn't have to build the program after every
change in code. Do I need to change a default setting in 2005?
|
by: Bardo |
last post by:
Hi all,
We are trying to debug an assembly which was built in debug configuration on
our build server. The output window of visual studio indicates that no
symbols are being loaded for the assembly.
However, when the PDB file is copied alongside the dll, the symbols load ok.
We were a little confused, because we had already been debugging this
assembly WITHOUT copying the pdb file.
What I discovered was that when the assembly is built...
|
by: =?Utf-8?B?SHVnaA==?= |
last post by:
Hi there
We are trying to build a C sharp solution in Visual Studio 2005 Professional.
We have a number of other assemblies, that do not form part of the solution.
Assemblies that do form part of the solution have been referenced using the
Projects tab in the Add Reference dialog.
Assemblies that do not form part of the solution have been added usingthe
|
by: Bev in TX |
last post by:
I am a complete newbie at building Python. I am trying to build it
under MS Windows Vista (64-bit AMD) with MS VS2005. I'm doing that
because I need debug libraries, which I did not see in the standard
distribution.
I downloaded the source and found the MSVS8 solution/project files.
However, when I tried to build it I got the following error:
....\python-2.5.2\modules\_sqlite\connection.h(33) : fatal error C1083:
Cannot open include...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |