Link to home
Start Free TrialLog in
Avatar of AndyAinscow
AndyAinscowFlag for Switzerland

asked on

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.

Avatar of jkr
jkr
Flag of Germany image

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)
Avatar of AndyAinscow

ASKER

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?
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?
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?
ps. Tea time here - I'll be back in about 3 hours after the kids are of to bed.
Just build it as release and then start it from the IDE, ignoring the warnings about ".... does not contain debug information"
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.
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.
duh - I explicitly call ShowWindow(SW_SHOWMAXIMIZED) in the OnInitDialog.  That explains the visibility.
>>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)
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.
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...
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.
Nice WE to you, too :o)
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).
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 ...).
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
OK, take you time :o)
slowly, slowly, catchy monkey.
That filemon app looks interesting.
Thanx :o)

sysinternals.com is a never ending source of useful tools...
I'll have to have a good browse there.