Solved

C Run-Time Error R6016

Posted on 2004-08-26
24
1,198 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
  • 15
  • 9
24 Comments
 
LVL 86

Expert Comment

by:jkr
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 44

Author Comment

by:AndyAinscow
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
duh - I explicitly call ShowWindow(SW_SHOWMAXIMIZED) in the OnInitDialog.  That explains the visibility.
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 44

Author Comment

by:AndyAinscow
Comment Utility
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
Comment Utility
Nice WE to you, too :o)
0
 
LVL 44

Author Comment

by:AndyAinscow
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
OK, take you time :o)
0
 
LVL 44

Author Comment

by:AndyAinscow
Comment Utility
slowly, slowly, catchy monkey.
0
 
LVL 44

Author Comment

by:AndyAinscow
Comment Utility
That filemon app looks interesting.
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
Thanx :o)

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

Author Comment

by:AndyAinscow
Comment Utility
I'll have to have a good browse there.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now