From: Jen on
Ajay,
The string looks exactly like I need it after this function call. I am
in release mode, so I put AfxMessageBox(queryStr.GetBuffer(0)), and the
string is fine. I then use this string to call Access to perform a
query and that is also exactly what I want.
The program just gives me an error when i close it. If I comment out
these lines, and instead hard cord in the query, I don't get the error
after closing.
Thanks!
Jen
Ajay Kalra wrote:
> queryStr.Format("Avg(IIf(E1.Param%d=0,0,(T1.Param%d-E1.Param%d)/(E1.Param%d)*100))",paramNum+1,paramNum+1,paramNum+1,paramNum+1);
>
> Can you step in this method and see if this is working correctly. Is
> the string as you expect after this function call?
>
> ---
> Ajay

From: Ajay Kalra on
> The string looks exactly like I need it after this function call. I am
> in release mode, so I put AfxMessageBox(queryStr.GetBuffer(0)), and the
> string is fine. I then use this string to call Access to perform a
> query and that is also exactly what I want.

That would mean CString did whatever it was supposed to do. I had
assumed from your post that problem is in CString and I dont think
thats the case.

> The program just gives me an error when i close it. If I comment out
> these lines, and instead hard cord in the query, I don't get the error
> after closing.

That does not mean that the problem lies in that line of code. Its very
very likely to be elsewhere. Keep in mind that CString has been in use
for a long time and you can safely assume that its doing its job.

---
Ajay

From: Jen on

Well I tried replacing all .Format commands with Ed's suggestion of
using a buffer, and still got the error.

So I believe that I have a random memory problem that only shows up in
Release mode. Any tips on how to track it down? I just don't know
what to try!

Jen

From: Ed Weir (ComCast) on
"Jen" <leonard522(a)aol.com> wrote in message
news:1156720829.837574.267440(a)i3g2000cwc.googlegroups.com...
|
| Well I tried replacing all .Format commands with Ed's suggestion of
| using a buffer, and still got the error.
|
| So I believe that I have a random memory problem that only shows up in
| Release mode. Any tips on how to track it down? I just don't know
| what to try!
|
| Jen

IIRC, when you removed the format for the query and replaced it with a
string const, the problem went away? Did you try removing the query itself
to test? I'm thinking that perhaps the response could be overstepping
allocated memory or stack frame. As Joe has mentioned before in previous
posts, this kind of bug is nightmarish to resolve. Years ago I used SoftICE
to solve hard to track problems like this, but even that is not easy...

Wish I could help more!

-- Ed.

-----------------------------------------------------
In dictatorships, you need courage to fight evil; in the free world, you
need courage to see the evil."
?Natan Sharansky

F9E7707A2AF502D0A899C6ACB43A2D35EB7E->bin->b64

From: Jen on
Hi ~
I replaced the .Format and used constants and left the query in. Then
I ran the program and it worked fine. I haven't tried removing the
query itself, but it works with a constant, so I thought that couldn't
be the problem?

I did try to use Application Verifier 3.2 to track the problem down,
and the program crashes leaving the following log:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <avrf:logfile xmlns:avrf="Application Verifier">
- <avrf:logSession TimeStarted="2006-08-27 : 20:09:17" PID="3944"
Version="1">
- <avrf:logEntry Time="2006-08-27 : 20:09:23" LayerName="Heaps"
StopCode="0x8" Severity="Error">
<avrf:message>Corrupted heap block.</avrf:message>
<avrf:parameter1>2a21000 - Heap handle used in the
call.</avrf:parameter1>
<avrf:parameter2>45ceac - Heap block involved in the
operation.</avrf:parameter2>
<avrf:parameter3>0 - Size of the heap block.</avrf:parameter3>
<avrf:parameter4>d6413f2e - Reserved</avrf:parameter4>
- <avrf:stackTrace>
<avrf:trace>vrfcore!VfCoreRedirectedStopMessage+81</avrf:trace>
<avrf:trace>ntdll!RtlpNtMakeTemporaryKey+393d</avrf:trace>
<avrf:trace>ntdll!RtlpNtMakeTemporaryKey+4a4b</avrf:trace>
<avrf:trace>ntdll!RtlpNtMakeTemporaryKey+4c4e</avrf:trace>
<avrf:trace>ntdll!RtlpNtMakeTemporaryKey+7cef</avrf:trace>
<avrf:trace>ntdll!RtlInitializeSListHead+115c0</avrf:trace>
<avrf:trace>ntdll!iswdigit+128</avrf:trace>
<avrf:trace>vfbasics!AVrfpRtlFreeHeap+16b</avrf:trace>
<avrf:trace>msvcrt!free+c3</avrf:trace>
<avrf:trace>vfbasics!AVrfp_free+1f</avrf:trace>
<avrf:trace>MFC42!Ordinal6667+43</avrf:trace>
<avrf:trace>EtrackerTrends!+402841</avrf:trace>
</avrf:stackTrace>
</avrf:logEntry>
+ <avrf:logEntry Time="2006-08-27 : 20:09:26" LayerName="TLS"
StopCode="0x352" Severity="Error">
<avrf:message>Using an invalid TLS index.</avrf:message>
<avrf:parameter1>7abba - TLS index</avrf:parameter1>
<avrf:parameter2>0 - Not Used.</avrf:parameter2>
<avrf:parameter3>0 - Not Used.</avrf:parameter3>
<avrf:parameter4>0 - Not Used.</avrf:parameter4>
- <avrf:stackTrace>
<avrf:trace>vfbasics!CheckTlsIndex+ce</avrf:trace>
<avrf:trace>vfbasics!AVrfpTlsSetValue+3b</avrf:trace>
<avrf:trace>MFC42!Ordinal2427+90</avrf:trace>
<avrf:trace>MFC42!Ordinal806+28</avrf:trace>

<avrf:trace>vrfcore!VfCoreStandardDllEntryPointRoutine+127</avrf:trace>


<avrf:trace>vfbasics!AVrfpStandardDllEntryPointRoutine+10e</avrf:trace>

<avrf:trace>ntdll!LdrInitializeThunk+29</avrf:trace>
<avrf:trace>ntdll!LdrShutdownProcess+142</avrf:trace>
<avrf:trace>kernel32!IsValidLocale+8eb</avrf:trace>
<avrf:trace>kernel32!ExitProcess+14</avrf:trace>
<avrf:trace>vfbasics!AVrfpExitProcess+3a</avrf:trace>
<avrf:trace>EtrackerTrends!CCycleData::operator=+da76</avrf:trace>
<avrf:trace>kernel32!RegisterWaitForInputIdle+49</avrf:trace>
</avrf:stackTrace>
</avrf:logEntry>
</avrf:logSession>
</avrf:logfile>


Any ideas on how to track it down from here?
Thanks ~
Jen