C Run-Time Error R6016

I am experiencing  a C Run-Time Error R6016 when in RELEASE mode.  in DEBUG mode the app works without a problem.  As far as I can tell it seems to happen in a third party (crystal report viewer) ActiveX viewer.


C Run-Time Error R6016
not enough space for thread data

The program did not receive enough memory from the operating system to complete a _beginthread call.

When a new thread is started, the library must create an internal database for the thread. If the database cannot be expanded with memory provided by the operating system, the thread will not begin and the calling process will stop.


Can I do anything to cure this and what.


ps.  Why do I think it is in the third party section?  The dialog that contains the viewer appears - it is now where the ActiveX viewer is actively formatting and displaying the report and then I get the error message.

LVL 45
AndyAinscowFreelance programmer / ConsultantAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jkrConnect With a Mentor Commented:
If a third party application really is involved, you could check that with FileMon (http://www.sysinternals.com/ntw2k/source/filemon.shtml). This would also help in tracking a file lock.
0
 
jkrCommented:
My only idea about this is that the heap' structures might really have been blown up just before that, and you mentioning that it works in release mode just adds up to that. But, that's just an assumption, and I am quite clueless apart from that one :o)
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
RELEASE BUILD:
Some more.  I am switching an image at runtime (and resizing it and the section the image is in).  I have now found that with a bitmap it works fine.  However using a gif file I get this error.  Even worse if I have the picture on a page header it works with a gif file, only when on page footer do I get this problem.
DEBUG BUILD:
I can't get it to fail at all


If I posted some code would that help?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
jkrCommented:
I don't think that your code will help if that whole thing breaks in that 3rd party module. As a side note: What happens if you run the release build under a debugger?
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
This is getting into areas that I don't know much about.
Crudely:- app calls extension dll (this base functionality shared between 4 apps).  That extension dll calls another extension dll which supplies my viewer dialog (that dll used by loads of apps) that contains the ActiveX viewer.
How do I go about attatching the running app to the debugger and which bit should I attach?
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
ps. Tea time here - I'll be back in about 3 hours after the kids are of to bed.
0
 
jkrCommented:
Just build it as release and then start it from the IDE, ignoring the warnings about ".... does not contain debug information"
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
That simple!
OK
First-chance exception in efactoRechnung.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

call stack
KERNEL32! 7c57e592()
MSVCRT! 78007108()
EFACTO3! 0032a189()
EFACTO3! 0032a053()
EFACTO3! 0032906c()

efacto3 is the extension dll that has the dialog with the activeX viewer on it.
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
Strange.
In the OnInitDialog (with the viewer on it) I have put an AfxMessageBox just prior to the return.  The report now appears, no failure AND the message box has not been dismissed.  Why should the dialog be visible - shouldn't the AfxMessageBox stop the onInitDialog.
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
duh - I explicitly call ShowWindow(SW_SHOWMAXIMIZED) in the OnInitDialog.  That explains the visibility.
0
 
jkrCommented:
>>First-chance exception in efactoRechnung.exe

1st chance exceptions really aren't a big problem (see e.g. http://support.microsoft.com/support/kb/articles/q105/6/75.asp - they are only 'seen' when using a debugger). Does the runtime error still occur when running under a debugger?

BTW: Grüezi ins Nachbarland :o)
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
Danke viel moll (Ich bin Englander deshalb mein Deutsch lässt etwas übrig - sind Sie in Deutschland oder Österreich)

runtime error - yes that is what the stack dump was from.
0
 
jkrCommented:
I'm German, but we still should stay with English on EE anyway :o)

Hmm, as a next step, you could try http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Turn_on_Generation_of_Debug_Information_for_the_Release_Build.asp ("Debugging a Release Build"). Maybe that's gonna get us a littler urther...
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
Thanks.  I'll give that a go but not today.  My brain is about to melt I think.
Have a good weekend, and thanks for the help.
0
 
jkrCommented:
Nice WE to you, too :o)
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
I am convinced it is a bug in crystal now.
I found a _com_error was being raised, I have caught this and display a message box with info.  The release build no longer crashes (good) and in the message box I get a message 'invalid filename'.
So far so good.
The bad news is that the picture is displayed correctly on some pages and not others (apparently random) BUT it is the same picture at the same location.  In debug mode it ALWAYS works correctly.

Do you have any ideas what could cause this (I can think of a file lock being set and an asynchronous operation trying to open the locked file).
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
Found out something interesting (and annoying).
Prepared my test PC with Win 2000 and installed the app.  No crash BUT gif and jpg just appear as placeholders for OLE Objects.  It looks like crystal calls another (third party?) program to read the picture and convert it to what it displays on the report.

I've downloaded an evaluation of the newest version of crystal - see if it works better with that else might have to say app only supports bmp format, (weasel out with other formats MAY work but ...).
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
I'll give that a whirl.

I am also thinking of replacing the code that changes the location at runtime with an alternative that accepts an IPictureDisp of the formatted picture - that should offer better performance I imagine as it should only require the picture files to be opened once per report rather than once per page.


The link to the debug info in release build is interesting.  I could just modify the settings of one dll and have breakpoints in it.
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
I have now implemented it with OleLoadPicture and passing the picture to crystal rather than the path to where it resides.  
It seems to work OK with bmp, gif, jpg files.  I am about to test it on other PC's now.
0
 
jkrCommented:
OK, take you time :o)
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
slowly, slowly, catchy monkey.
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
That filemon app looks interesting.
0
 
jkrCommented:
Thanx :o)

sysinternals.com is a never ending source of useful tools...
0
 
AndyAinscowFreelance programmer / ConsultantAuthor Commented:
I'll have to have a good browse there.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.