STL list gets cleared randomly

O

Olumide

Hello -

I'm currently debugging a method which among other things, adds items
to a list. However, every so often the list size gets set to zero
"midstream". I've taken care not to clear the list, and I've tested
for a bad alloc exception, but there is none. (I'd post the code, but
it would take a lot of space.)

Has anyone ever experienced this sort of error? Barring a problem with
VS .NET 2003 STL implementation, I'm starting to suspect stack
corruption.

Alternatively, I'd appreciate some guidance on how to watch the size
of the list and halt the debugger when it gets resized.

Thanks,

- Olumide
 
V

Vladimir Jovic

Olumide said:
Hello -

I'm currently debugging a method which among other things, adds items
to a list. However, every so often the list size gets set to zero
"midstream". I've taken care not to clear the list, and I've tested
for a bad alloc exception, but there is none. (I'd post the code, but
it would take a lot of space.)

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8
By creating the minimal example that demonstrate the problem, you are
likely to find the solution.
Has anyone ever experienced this sort of error? Barring a problem with
VS .NET 2003 STL implementation, I'm starting to suspect stack
corruption.

This kind of problems are solvable with valgrind (if the stack
corruption is really the problem).
Alternatively, I'd appreciate some guidance on how to watch the size
of the list and halt the debugger when it gets resized.

Go step by step, and see when it change the size.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top