473,473 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

tracking down random memory clobbering, any tools/tips?

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 clobbering any specific
identifiable piece of memory that I can breakpoint on or anything). Are
there any tools out there that I can use to help track this down?
Anyone got any tips to help with this?
Sep 16 '07 #1
1 1261
"Jonathan Wilson" <jf*****@tpgi.com.auwrote in message
news:e2****************@TK2MSFTNGP03.phx.gbl...
>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 clobbering any specific
identifiable piece of memory that I can breakpoint on or anything). Are
there any tools out there that I can use to help track this down?
Anyone got any tips to help with this?

I am presuming that it is a native unmanaged dll. Usually when you are
stomping on "random" locations, it's because you either are using the wrong
calling convention, or you have an uninitialized local variable in your
function (meaning that while you are using a garbage address, it is still
inside your virtual address space)...

Compile a debug version with the following properties:

Compile Properties C/C++ Code Generation: Basic Runtime Checks to both
(stack frame and uninitialized variables) - This fenceposts your functions
(this is usually the default, by the way).

You can also do:

#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>

// the following allows me to trap memory problems with "new" in C++ -
doesn't work in all cases but it helps YMMV
#ifdef _DEBUG
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif
You can then check your memory right before you see you are having problems
or right at the end of your functions, which will fire an assertion and
opportunity to debug if there is a memory issue detected by the debug memory
allocation routines.

_ASSERTE(_CrtCheckMemory());

(You can look into the crt debug functions in MSDN for more information.)

None of these options would be included in a release build (_ASSERTE's are
#ifdefed out, /RTC1 is not supported with optimizations enabled).

--
Doug Semler, MCPD
a.a. #705, BAAWA. EAC Guardian of the Horn of the IPU (pbuhh).
The answer is 42; DNRC o-
Gur Hfrarg unf orpbzr fb shyy bs penc gurfr qnlf, abbar rira
erpbtavmrf fvzcyr guvatf yvxr ebg13 nalzber. Fnq, vfa'g vg?

Sep 17 '07 #2

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

Similar topics

3
by: Shanfeng Cheng | last post by:
I write a piece of code to tracking the number of clicks on a link each day. The link usu. gets about 3000-6000 clicks per day. I just store today's click count in a one-line text file, like, ...
4
by: Tim Graichen | last post by:
Does anybody have code for real geneology tracking through many generations? And maybe an associated family tree report? Tim
7
by: Ian Hinson | last post by:
I have an Access app that has been distributed with run-time installation to many different customers over many years. It is developed in Access 2000. The custom menu bar has had no problems in...
6
by: depkefamily | last post by:
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...
8
by: Daniel | last post by:
Hey guys Using Random(), how random is it, is it possible to be predicted? I have a requirement for a very good random number generator. I was doing something such as: Random randomSeed = new...
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...
6
by: Chad | last post by:
When the following functions takes the string "this is a string" static void *build_string(char *s) { int k; char *start; size_t len; size_t max; len = strlen(s);
1
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have an xml for example: <xml> <data> <var>xxx</var> </data> <tip> <tips active="1">345</tips> <tips active="1">retertert</tips> <tips active="1">fdgdfg</tips> <tips...
0
by: LiveTecs | last post by:
http://www.livetecs.com TimeLive Web Collaboration Suite is an integrated suite that allows you to manage project life cycle including tasks, issues, bugs, timesheet, expense, attendance. ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.