472,326 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,326 software developers and data experts.

Any ideas on tracking down memory corruption

I have a large C++ program using multiple vendors DLLs which is giving
me a major
headache. Under release mode I get exceptions thrown from what looks
like a dereferenced
corrupt pointer. The problem is that when I change the inputs the
location of the corruption
moves, looking to me like someone is trashing memory and then later I
see the results. The
location also shifts when I change some of the code, although I have
been unable to see the pattern.

I am running on Windows 2000 using Visual C++ 6.0 SP3 and the latest
update of Purfify
Plus. Purify is able to give me a stack trace at the point of the
exception but not when the
memory gets corrupted(which I presume is happening). I have yet to
reproduce the problem in
debug mode.

This all started when I got the latest version of a DLL from one of the
vendors. I tried taking it
up with them but they want me to produce a test case for them. If it
weren't for their
reputation I would be more skeptical of their code but at this point I
can only be suspicious.
Is it possible that there is a conflict in running the combination of
DLLs, and if so how do you
figure out what the problem is. All of the DLLs contain proprietary
code which I do not have.

I thought purify could/should catch something like this. What do you
all use in situations like
this? Aside from shifting some code around and creating objects at
various places on the
heap and stack til I find the pattern, I am at a loss. Also I am not
running out of memory,
already checked that.

Thanks, I am very curious to see what techniques others use.

Tom

Mar 18 '06 #1
6 2343
de*********@gmail.com wrote:
I have a large C++ program using multiple vendors DLLs which is giving
me a major
headache. Under release mode I get exceptions thrown from what looks
like a dereferenced
corrupt pointer. [...]

I thought purify could/should catch something like this. What do you
all use in situations like
this? Aside from shifting some code around and creating objects at
various places on the
heap and stack til I find the pattern, I am at a loss. Also I am not
running out of memory,
already checked that.


If the behaviour is reproducible with the same data, and you know which
pointer is corrupted, stop right after the pointer is created and set to
its proper value (if you know what and where it is), and then create
a breakpoint for changes in that variable, if your debugger allows that.
The execution is going to be slow after that, but if the behaviour is
not time- or performace-sensitive, you should be able to pinpoint the
code that screws with this pointer (directly or by overrunning some other
memory).

The difference between debug and release modes also is a hint: in some
cases in debug mode all variables are initialised to something (like 0),
and in release they are not, that can play a role, so look for the uses
of uninitialised objects (even if it's just a 'bool' variable).

V
--
Please remove capital As from my address when replying by mail
Mar 18 '06 #2
Tom
Can you setup breakpoints in VS 6.0 built under release mode? I just
tried and when
the app starts all break points are disabled.

Mar 18 '06 #3
Tom wrote:
Can you setup breakpoints in VS 6.0 built under release mode? I just
tried and when
the app starts all break points are disabled.


This is compiler-specific. Please go to 'microsoft.public.vc.*'
hierarchy and find an appropriate newsgroup to talk about those.

V
--
Please remove capital As from my address when replying by mail
Mar 18 '06 #4

"Tom" <de*********@gmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
Can you setup breakpoints in VS 6.0 built under release mode? I just
tried and when
the app starts all break points are disabled.


So how about changing the release mode settings to settings that allow
debugging to be built into your app? (Note that this is a hint to you as to
how to solve your problem -- please ask further questions concerning this in
Visual C++ related newsgroups)..

- Paul
Mar 19 '06 #5
Tom
I can follow up on this in the VS groups, but I didn't think this had
anything to do with
their compiler. If I were to use g++ or other compiler and not include
the symbol table,
which is what release mode does, how would you set break points as was
suggested?
I was just seeking general techniques on tracking down memory bugs.

Mar 19 '06 #6
Tom wrote:
I can follow up on this in the VS groups, but I didn't think this had
anything to do with
their compiler.
If debugging information weren't compiler-speicific, we'd have it defined
in the Stadnard. As it stands, no debugging information is even mentioned
in the Standard document. That means that it doesn't have to even exist.
If I were to use g++ or other compiler and not include
the symbol table,
which is what release mode does, how would you set break points as was
suggested?
Ask in a g++ newsgroup. Or other compiler newsgroup. There is a way to
make the compiler generate "symbol table" or whatever else goes into the
debugging information even in "release mode".
I was just seeking general techniques on tracking down memory bugs.


I gave you one. Now, how to do it with a particular compiler is not topical
here. So please stop asking. Nobody can answer it here without veering off
topic. Go to your compiler's newsgroup.

V
--
Please remove capital As from my address when replying by mail
Mar 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Noa Garnett | last post by:
I'm developing on C++, using visual studio 6.0 with service pack 5. I have a memory corruption while debugging. Some of the variables I'm using are...
11
by: darcykahle | last post by:
I have stumbled upon an interesting issue with regard to compaction of an access frontend database which resides on a DFS target that utilizes FRS...
4
by: indushekara | last post by:
Hi, We are having memory corruption in our application somewhere, unable to find out. one part of code we found that we are specifying wrong...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the...
6
by: DFS | last post by:
One of my systems grew exponentially - from 13mb to 43mb - after adding some 10 temp tables (with no data), a new form, and about a thousand lines...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms...
3
by: =?Utf-8?B?R3JhaGFt?= | last post by:
I've added 2 tracking services to the wf runtime; one is the standard SqlTrackingService: trackingService = new...
1
by: Jonathan Wilson | last post by:
I have a closed source app. I have a .dll plugin for this app (which I am writing). This plugin contains a bug somewhere which seems to clobber...
66
by: Why Tea | last post by:
typedef struct some_struct { int i; short k, int m; char s; } some_struct_t; Assuming 16 bit or 32-bit alignment, can I assume that s...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.