[C++-sig] Re: Re: problems with std::string (complete msg.)

jsseo jsseo at postech.ac.kr
Wed Dec 10 01:37:46 CET 2003


> "RaoulGough" writes:
> 
> "jsseo"  writes:
> 
> > I'm sorry but the previous messages I sent were broken because of the
> > mailing system that I use.
> > Here is the original message.
> >
> > When I passed a string parameter that is longer than 15,
> > the program hals with the following assertion failed error message.
> > The error occured when I built the project for "Debug" mode.
> > (compiler: Microsoft Visual Studio .NET 2003)
> >
> > e.g. in python interpreter,
> > from ex1 import *
> > e = Ex("123456789012345") <-- ok
> > e = Ex("1234567890123456") <-- error
> > e.name = "123456789012345" <-- ok
> > e.name = "1234567890123456" <-- error
> >
> > the error message
> > -----------------------------
> > Program:c:\python22\python.exe
> > File:dbgheap.c
> > Line: 1132
> > Expression: _CrtlsValidHeapPointer(pUserData)
> 
> Looks like heap corruption to me. It could be that the slightly longer
> string requires a new memory (re)allocation internal to the
> std::string object, which only then detects a corruption that occured
> earlier. This could be due to almost anything, of course. Can you
> reproduce the problem using straight C++? Might be easier to track
> down that way. You mind find some kind of memory leak or
> write-past-the-end detection code useful (e.g.
> http://dmalloc.com/). Slightly off-topic here I guess, since it seems
> likely to be a straight old C++ problem.
> 
> -- 
> Raoul Gough.
> export LESS='-X'
> 

Thank you for reply.
I tried to reproduce the problem using straight C++.
But, the strait C++ code works well.
In my thought, using "boost_python.dll" makes no problem, 
but using "boost_python_debug.dll" makes "python.exe(python22.dll)"
produce the assertion fail message.
I don't know why the project for "boost python debug version" 
did not link with "python22_d.lib" and it linked with "python22.lib."

Thanks.





More information about the Cplusplus-sig mailing list