This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Possible memory issue with optparse
Type: resource usage Stage:
Components: Extension Modules Versions: Python 2.6
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: loewis, wfspotz
Priority: normal Keywords:

Created on 2009-12-03 16:47 by wfspotz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg95936 - (view) Author: Bill Spotz (wfspotz) Date: 2009-12-03 16:47
I develop python extension modules for Trilinos, a large scientific 
computing project:

    http://trilinos.sandia.gov

Unit testing my extension modules under Mac OS X, I came across the 
following error messages after upgrading from gcc 4.0 to basically any 
higher version:

  python(65587) malloc: *** error for object 0x1715674: Non-aligned 
pointer being freed

Debugging the problem (which occurs for me in several places in several 
test scripts), the error was always being raised in the built-in C++ 
method

  ostream::operator<<(int)

which indicated to me that the problem was really probably somewhere 
else, and just being triggered in the ostream operator.

Trying to isolate the problem in a smaller script, I was unable to 
reproduce the error until I added

  import optparse

By the same token, I was able to eliminate the problem in my test 
scripts by getting rid of "import optparse".  I have changed these 
scripts now to use getopt, and they are running without error, but I 
thought I would report this strange behavior.

I realize after all of this that the problem might not actually be with 
optparse, but it sure seems like a likely culprit.  I would be happy to 
work with someone to try to reproduce the error, and then hopefully 
such a python expert would be able to find the actual issue.
msg95941 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2009-12-03 19:37
optparse itself is a pure-python library, so it can't possibly cause
memory errors. 

Thanks for the report, but there isn't any realistic chance that we can
do anything with it. So closing it as won't fix.

If you want to debug it further, I would run a debug version of malloc.
Not sure whether OSX comes with one (apart from Python's own memory
debugging), if not, I'd use a memory debugger on a different platform.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51677
2009-12-03 19:37:40loewissetstatus: open -> closed

nosy: + loewis
messages: + msg95941

resolution: wont fix
2009-12-03 16:47:27wfspotzcreate