Problem with C++ STL string, getString() and VARCHAR... [message #254245] |
Thu, 26 July 2007 05:04 |
miliziano
Messages: 1 Registered: July 2007 Location: ITALY
|
Junior Member |
|
|
Hi,
I've an incredible problem with memory when I try to extract a string from Oracle by means of OCCI.
The problem occurs when the method ends. Example:
void function(){
string _str;
//... the connection...
//... the executeQuery...
_str=_rs->getString(1);
cout<<_str;
//... It's ok.
//...close result set and other...
}
...but when the method ends, the runtime language crashes because it doesn't can free the string object (_str).
This problem doesn't occour with CHAR type (in the DB). Only with VARCHAR.
The stack trace is:
*** glibc detected *** /home/marco/workspace2/Runtime/bin/ConfMgr: munmap_chunk(): invalid pointer: 0x08099dc0 ***
======= Backtrace: =========
/lib/libc.so.6[0xb6b126e1]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb6cbcf81]
/usr/lib/libstdc++.so.6(_ZNSs4_Rep10_M_destroyERKSaIcE+0x1d)[0xb6c9a03d]
/usr/lib/libstdc++.so.6(_ZNSsD1Ev+0x57)[0xb6c9cbc7]
...
In the debug mode I can see that is the free of _str that produces the problem.
The Environment is GCC 4.1.2, Eclipse CDT and OCCI for Oracle 10.1.2
Thanks...
|
|
|
|