Lot corruption under Win32; just how to situate?
I'm working with a multithreaded C++ application that is damaging the lot. The common tools to situate this corruption appear to be inapplicable. Old builds (18 months old) of the resource code show the very same practices as one of the most current release, so this has actually been around for a long period of time and also simply had not been seen; on the disadvantage, resource deltas can not be made use of to recognize when the bug was presented - there are a whole lot of code adjustments in the database.
The punctual for collapsing behaviuor is to create throughput in this system - outlet transfer of information which is munged right into an inner depiction. I have a set of examination information that will occasionally create the application to exception (numerous areas, numerous reasons - consisting of lot alloc falling short, hence: lot corruption).
The practices appears pertaining to CPU power or memory transmission capacity; the even more of each the equipment has, the less complicated it is to crash. Disabling a hyper-threading core or a dual-core core lowers the price of (yet does not remove) corruption. This recommends a timing relevant concern.
Currently below's snag:
When it's run under a light-weight debug setting (claim
Visual Studio 98 / AKA MSVC6) the lot corruption is sensibly very easy to duplicate - 10 or fifteen mins pass in the past something falls short horrendously and also exemptions, like an
alloc; when running under an innovative debug setting (Rational Purify,
VS2008/MSVC9 or perhaps Microsoft Application Verifier) the system comes to be memory-speed bound and also does not crash (Memory-bound: CPU is not obtaining over
50%, disk light is out, the program's going as quickly it can, box consuming
1.3G of 2G of RAM). So, I've obtained a selection in between having the ability to duplicate the trouble (yet not recognize the reason) or having the ability to idenify the reason or a trouble I can not duplicate.
My existing ideal hunches regarding where to next is:
- Get a hugely grunty box (to change the existing dev box: 2Gb RAM in an
E6550 Core2 Duo); this will certainly make it feasible to repro the crash creating mis-behaviour when running under an effective debug setting; or
- Revise drivers
deleteto make use of
VirtualProtectto mark memory as read-only as quickly as it's performed with. Run under
MSVC6and also have the OS capture the bad-guy that's contacting released memory. Yes, this suggests anxiety: that the heck revises
delete?! I ask yourself if this is mosting likely to make it as slow-moving as under Purify et al.
. And also, no Delivering with Purify instrumentation constructed in is not an alternative.
A coworker simply strolled previous and also asked "Stack Overflow? Are we obtaining pile overflows currently ?!?"
And currently, the inquiry: Just how do I situate the lot corruptor?
new and also
delete appears to have actually obtained a lengthy means in the direction of addressing the trouble. As opposed to 15mins, the application currently deals with 2 hrs prior to collapsing. Not there yet. Any kind of more pointers? The lot corruption lingers.
Update: a release construct under Visual Studio 2008 appears substantially much better; existing uncertainty hinges on the
STL execution that ships with
- Duplicate the trouble.
Dr Watsonwill certainly generate a dump that could be handy in more evaluation.
I'll take a note of that, yet I'm worried that Dr Watson will just be floundered after the reality, not when the lot is obtaining stomped on.
An additional shot could be making use of
WinDebugas a debugging device which is fairly effective going to the very same time additionally light-weight.
Got that addressing the minute, once more: very little aid till something fails. I intend to capture the mischief-maker in the act.
Possibly these tools will certainly permit you at the very least to tighten the trouble to particular part.
I do not hold much hope, yet hopeless times call for ...
And are you certain that all the parts of the task have proper runtime collection settings (
C/C++ tab, Code Generation group in VS 6.0 task settings)?
No I'm not, and also I'll invest a number of hrs tomorrow experiencing the work space (58 tasks in it) and also examining they're all assembling and also relating to the ideal flags.
Update: This took 30 secs. Select all tasks in the
Settingsdialog, unselect till you locate the task (s) that do not have the appropriate settings (they all had the appropriate settings).
I have very same troubles in my job (we additionally make use of
VC6 occasionally). And also there is no very easy remedy for it. I have just some tips:
- Try with automated crash manufacturing equipment (see Process Dumper). My experience claims Dr. Watson is not excellent for unloading.
- Remove all catch (...) from your code. They usually hide significant memory exemptions.
- Examine Advanced Windows Debugging - there are great deals of wonderful pointers for troubles like your own. I recomend this with all my heart.
- If you make use of
STLPortand also examined builds. Void iterator are heck.
All the best. Troubles like your own take us months to address. Await this ...
You attempted old builds, yet exists a factor you can not maintain going better back in the repository background and also seeing specifically when the bug was presented?
Or else, I would certainly recommend including straightforward logging of some kind to aid locate the trouble, though I go to a loss of what especially you could intend to log.
If you can figure out just what CAN create this trouble, using google and also documents of the exemptions you are obtaining, possibly that will certainly offer more understanding on what to seek in the code.
My first activity would certainly be as adheres to :
- Build the binaries in "Release" variation yet developing debug details documents (you will certainly locate this opportunity in task settings).
- Usage Dr Watson as a defualt debugger (DrWtsn32 - I) on an equipment on which you intend to duplicate the trouble.
- Repdroduce the trouble. Dr Watson will certainly generate a dump that could be handy in more evaluation.
An additional shot could be making use of WinDebug as a debugging device which is fairly effective going to the very same time additionally light-weight.
Possibly these devices will certainly permit you at the very least to tighten the trouble to particular part.
And also are you certain that all the parts of the task have proper runtime collection settings (C/C+npls tab, Code Generation group in VS 6.0 task settings)?
My front runner would certainly be a committed lot device such as pageheap.exe.
Revising new and also delete could be valuable, yet that does not capture the allocs devoted by lower - degree code. If this is what you desire, far better to Detour the
low-level alloc APIs making use of Microsoft Detours.
Additionally peace of mind checks such as : validate your run - time collections match (release vs. debug, multi - threaded vs. solitary - threaded, dll vs. fixed lib), seek negative deletes (eg, delete where delete [ ] need to have been made use of), see to it you're not blending and also matching your allocs.
Additionally attempt uniquely switching off strings and also see when/if the trouble vanishes.
What does the call pile etc resemble at the time of the first exemption?