Solved

C Run-Time Error R6016

Posted on 2004-08-26
24
1,202 Views
Last Modified: 2013-11-20
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.

0
Comment
Question by:AndyAinscow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 15
  • 9
24 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 11908844
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11910179
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
 
LVL 86

Expert Comment

by:jkr
ID: 11913208
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Author Comment

by:AndyAinscow
ID: 11914100
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11914114
ps. Tea time here - I'll be back in about 3 hours after the kids are of to bed.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11914299
Just build it as release and then start it from the IDE, ignoring the warnings about ".... does not contain debug information"
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11916401
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11916499
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11916508
duh - I explicitly call ShowWindow(SW_SHOWMAXIMIZED) in the OnInitDialog.  That explains the visibility.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11916543
>>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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11916647
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
 
LVL 86

Expert Comment

by:jkr
ID: 11916692
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11916740
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
 
LVL 86

Expert Comment

by:jkr
ID: 11916794
Nice WE to you, too :o)
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11929433
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11929501
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
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 11934725
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11939212
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
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11941802
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
 
LVL 86

Expert Comment

by:jkr
ID: 11946436
OK, take you time :o)
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11946498
slowly, slowly, catchy monkey.
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11956718
That filemon app looks interesting.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11956744
Thanx :o)

sysinternals.com is a never ending source of useful tools...
0
 
LVL 44

Author Comment

by:AndyAinscow
ID: 11956766
I'll have to have a good browse there.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question