473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 2469
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 suddenly set to zero while progressing along the...
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 to mirror the sharepoint, and I was wondering if...
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 format specifier. Could anyone let me know if the...
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 Memory Corruption while executing the program ? ...
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 of code. The .mdb has mostly table links, lots of...
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 and retain the data users have entered. I thought...
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 SqlTrackingService(<trackingConnectionString>); <workflow...
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 memory in a "random" fashion (as in, its not...
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 always gets 4 or 8 bytes of allocation due to padding
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.