B
Billy Patton
I have this test code:
{
String s("123");
OK(s.Len() == 3);
OK is a define to print __LINE__ and increment a test_count and a failure count
String is built using std::string as the memory namager for the string.
I have the following method:
This one produces no errors with purify.
size_t String::Len(void)
{
if (str.empty()) return 0;
return strlen(str.c_str());
// return str.size();
}
size_t String::Len(void)
{
return str.size();
}
THe routine above produces the one above. The folowing is from purify:
Finished test ( 1 error, 0 leaked bytes)
Purify instrumented SunOS/32/test (pid 15865 at Thu May 26 07:32:17 2005)
UMR: Uninitialized memory read
This is occurring while in:
__big_float_times_power [libc.a]
__binary_to_decimal_fraction [libc.a]
_unpacked_to_decimal_two [libc.a]
__k_double_to_decimal [libc.a]
double_to_decimal [libc.a]
econvert [libc.a]
Reading 2 bytes from 0xffbedfda on the stack.
Address 0xffbedfda is 1086 bytes below frame pointer in function
__k_double_to_decimal.
Current file descriptors in use: 5
Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 0 0
Potentially Leaked 1 8200
In-Use 0 0
----------------------------------------
Total Allocated 1 8200
Program exited with status code 0.
* Basic memory usage (including Purify overhead):
2566822 code
1947676 data/bss
16388 heap (peak use)
3040 stack
It appears that std::string::size is causing the error.
I use gcc 3.4.2 on a solaris 8 box.
purify.sol.2002a.06.00
Since IBM bought Purify we don't see updates/new releases
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, (e-mail address removed)
{
String s("123");
OK(s.Len() == 3);
OK is a define to print __LINE__ and increment a test_count and a failure count
String is built using std::string as the memory namager for the string.
I have the following method:
This one produces no errors with purify.
size_t String::Len(void)
{
if (str.empty()) return 0;
return strlen(str.c_str());
// return str.size();
}
size_t String::Len(void)
{
return str.size();
}
THe routine above produces the one above. The folowing is from purify:
Finished test ( 1 error, 0 leaked bytes)
Purify instrumented SunOS/32/test (pid 15865 at Thu May 26 07:32:17 2005)
UMR: Uninitialized memory read
This is occurring while in:
__big_float_times_power [libc.a]
__binary_to_decimal_fraction [libc.a]
_unpacked_to_decimal_two [libc.a]
__k_double_to_decimal [libc.a]
double_to_decimal [libc.a]
econvert [libc.a]
Reading 2 bytes from 0xffbedfda on the stack.
Address 0xffbedfda is 1086 bytes below frame pointer in function
__k_double_to_decimal.
Current file descriptors in use: 5
Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 0 0
Potentially Leaked 1 8200
In-Use 0 0
----------------------------------------
Total Allocated 1 8200
Program exited with status code 0.
* Basic memory usage (including Purify overhead):
2566822 code
1947676 data/bss
16388 heap (peak use)
3040 stack
It appears that std::string::size is causing the error.
I use gcc 3.4.2 on a solaris 8 box.
purify.sol.2002a.06.00
Since IBM bought Purify we don't see updates/new releases
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodology Group
Dallas, Texas, 214-480-4455, (e-mail address removed)