|
I still don't know the correct answer to this one.....
If you create a DLL and an EXE, both linked to use the DLL version of the RTL -- is it the case the the DLL and the EXE are using the exact same heap. Can you at this point, delete memory (in the EXE) which was allocated in the DLL?
If they are not, how do they do it? How would they manage to dynamically allocate a different heap to each DLL/EXE?
-p
|
|
|
|
|
Peter Weyzen wrote:
If you create a DLL and an EXE, both linked to use the DLL version of the RTL -- is it the case the the DLL and the EXE are using the exact same heap. Can you at this point, delete memory (in the EXE) which was allocated in the DLL?
Yes, and Yes.
I vote pro drink
|
|
|
|
|
My app keeps generating Access Violations after my program exits(More like after my code is finished and the system code is finishing up) and I can't find out why for the life of me... Any ideas as to what might cause this?
Also, are there any good Memory Monitors( like boundschecker) that are free?
Stephen Caldwell
Blackfission, CEO
|
|
|
|
|
Also, are there any good Memory Monitors( like boundschecker) that are free?
VC++'s C run-time library includes some rudimentary functions for out-of-bounds error checking and related stuff. Check MSDN article Debug Reporting Functions of the C Run-Time Library. Some samples are also included on the documentation.
Not very powerful, but they're good as a starting point as they're free and ready to use.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Have you managed to get the debugger to break on one of these Access Violations? 0xC0000005...
|
|
|
|
|
Go into debug mode and look at the call stack!
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Is there a way to tell how much stack space I need?
I have a multi threaded app that creates worker threads. There are very few variables in the main app. I am getting strange memory errors. Is it possible the default stack size for the threads (= stack size of main) is too small?
How can I find out how big it is?
How can I find out how big it needs to be?
I get no explicit errors, just lots of strange things.
Thanks for the help,
Bill
|
|
|
|
|
I'd say the default stack size is much more than necessary for the needs of normal apps. The only way a normal app can run out of stack size is because of some bug that causes an infinite chain of recursive calls to functions. But then again, you have no reason to suspect this is happening.
My suggestion is that you try to look for another reason to your strange errors. If you describe the problem with more detail we could try to help you more than this.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
My concern was that the actual stack requirements of a worker thread greatly exceeds that of the parent thread. The parent merely dispatches jobs to the workers. I thought maybe I didn't have enough stack space in the worker threads.
The specific problem (at the moment) is with using Crystal Reports. I have a wrapper class (CCrystalReports) that uses the CR API (not the com object). The wrapper has been used successfully in several single threaded apps.
I've tried this two different ways with different, but always disappointing , results.
1. Make CCrystalReports a member of the Worker thread class. This mode of operation had no memory problems as far as I can tell. Crystal Reports, however, failed to open the report file in this configuration.
2. Make CCrystalReports a dynamic in a method called by the worker thread. (So it is automatically destroyed at the right time. This runs for awhile, then blows when trying to return from the method.
The actual blow up occurs in yet another program. The app I have been discussing supports a COM interface. Another program uses this interface to submit requests to the app, which then dispatches them to worker threads. The blowup comes in the Invoke call it returns the following error:
(8007000e) Not enough storage is available to complete this operation.
Any advice would be appreciated. This project has gone on too long!
Thanks for the help,
Bill
|
|
|
|
|
Hmmm. Are you using Oracle? From MSDN:
... applies to Microsoft OLE DB Provider for Oracle, version 2.1, 2.5... The following error message may appear when 5000 records or more are retrieved, and when each record contains 4 bytes of data: 8007000e Not enough storage is available to complete this operation... Note that the computer is not really out of memory... To work around this problem, return recordsets larger than 4 bytes... This problem was corrected in MDAC 2.6
Even if it isn't Oracle, my guess is that it's the DB provider setting that error.
Let me try to understand. Application A supports a COM dispatch interface, and contains the worker threads. Application B calls into application A through the dispatch interface using Invoke(), but that call returns the 8007000e error code. Is this right? If so, is the call actually getting into Application A? I have a feeling it is, and that the error is being propagated all the way back from your DB layer.
I could just be making this sh*t up though...
J
|
|
|
|
|
Hi
I'm searching a Control that enables me to write an application that has that special Outlook style ... I mean the
ListView in Outlook where your emails are listed, where you can add and delete rows AND especially where you can form
one or more group ... like group the emails after the sender and getting then a grey list of names with a '+'sign
that you can open und seeing the emails from that person then ... I hope you know what I'm talking about. Please can
someone help me and tell me where I can find such a control??
Thank you in advance Grit
|
|
|
|
|
I have not used this one, but I came across it a while ago. It looked pretty good.
http://www.devexpress.com.
I would not recommend trying to write your own. Not work the effort.
|
|
|
|
|
One of my favorite Outlook style control is Maarten Hoeben's Report control. Take a look at
it Here.
- God bless the World
|
|
|
|
|
I am a beginner programmer and have just started trying Visual C++. I've set up a view/document program that will open dialog boxes based on menu selections. The problem I have is getting information to/from the document class into a given dialog box. How do I do this? Is it better to be modal or modeless? It appears that the dialog box doesn't have a Getdocument( ) function. Did I do something wrong in defining the dialog box class?
|
|
|
|
|
Dialog boxes do not have a GetDocument function, because they're not normally part of the document/view architecture.
As for modal/modeless dialogs, which one to use will depend on your needs: modal dialogs, when started with DoModal , block the rest of the program so that the user can only interact with the dialog until s/he presses "OK" or "Cancel" (the rest of the windows appear disabled and grayed out). Modeless dialogs, on the contrary, coexist with the rest of the app and do not block user input to other windows.
I'd say modal dialogs are simpler to handle for a starter. The way to incorporate a modal dialog into your document/view app could be sketched along these lines:- Let the MFC wizard create a
CDialog -based class for your use, and add a CYourDocument * variable that gets initialized on construction time: you will have to add an extra parameter to the constructor of your class, just like this:
CYourDlg(CYourDocument * pDoc,CWnd* pParent = NULL);
- The dialog normally will pop up on response to some command: add a command handler for it, and show the dialog as follows:
void CYourFrameWnd::CYourCommand()
{
CYourDialog dlg(GetDocument());
dlg.DoModal();
} This way you have access to the document from within the code of your CDialog -based class. Hope the explanation has shed some light. The topic is much too broad to give but a small indication to get you started.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi !
Well, one way to solve the document problem that you have is to pass in the DoModal of the Dialog as a parameter your Document ( then you can play with the data inside your dialog having that pointer to the document), just override DoModal in your dialog ( you have to declare that virtual).
Modal dialogs are easier to use ( for the programmer and for the users) than modeless, so maybe better to use modal dialogs whenever is possible and modeless only when is needed.
A good place to look for answers is: http://www.deja.com
HTH
Braulio
|
|
|
|
|
If what you're after is having commited pages with increasing contiguous addresses without imposing an a priori limit, you can always reserve the largest block of memory the system allows you to (which is 2GB minus some safeguard amount of memory for the rest of the program and libraries, say 1.8GB). After all, reserving such a huge block of memory costs nothing --the system is only doing some bookkeeping of your request.
It's better to reserve this block of memory as soon as you can, so that the memory hasn't been fragmented by then.
If you run out of memory after consuming the 1.8GB, then there's nothing more you can do: a process cannot simply handle more memory than that.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi
I hope this question is an easy one for all you experts here at CodeProjetct
I have a dialog based app that launches another modeless dialog in OnInitDialog using Create and ShowWinow. So far everything works.
I declared a new struct using
struct CONFIG
{
CString one, two, three, andsoon;
}
The main dialog has a member variable named
CONFIG cfg
Now my question:
My second dialog needs to have access to this variable in order to read some values out of it
How do I set it up in order to be able to read values from CONFIG cfg from my second, modeless dialog?
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Gregor,
If you created the modeless dialog from the main dialog with something like Create(ID_MODELESS_DLG,this) (where this refers to the main dialog) then the modeless dlg has the main one as its parent, and the sentence
((CYourDlg *)GetParent())->cfg access the variable cfg . Note the casting to CYourDlg * (or whatever your main dialog class is called).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
i used this article http://www.codeproject.com/com/vb_from_vc.asp to call a function from a vb dll but if i created a function with multi params then for some reason my string gets lost!!
I have used this in visual basic:
Sub irc_1_client_init(ByVal what_nick_name As String, ByVal what_server As String, ByVal what_channel As String)
blah
end sub
--------------------------------------------------------------------------------
and in c++ i call the function like this :
irc_clientClass->irc_1_client_init(_bstr_t("blah"), _bstr_t("east.gamesnet.net"), _bstr_t("#blah"));
but when the event triggers it dont send the strings to the dll for some reason the strings get lost!
|
|
|
|
|
There is an article here:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q145616
which explains how to activate the cut, copy, paste commands of Edit. The second step says:
Add an UPDATE_COMMAND_UI handler for ID_EDIT_COPY & ID_EDIT_CUT:
What exactly does that mean? If I add a public member function
public:
void OnUpdateNeedSel(CCmdUI* pCmdUI);
The program seems to work okay. I just don't understand what UPDATE_COMMAND_UI means. Do I need to add something to BEGIN_MESSAGE_MAP????
Please, please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Those UPDATE_COMMAND_UI handlers are called by the framework to determine whether the handled command (ID_EDIT_COPY , etc.) should be enabled or disabled on your menu. If you don't provide those, my guess is that the commands "Copy" and "Cut" will remain enabled all the time, even when there's nothing to copy (nor cut).
Do I need to add something to BEGIN_MESSAGE_MAP????
Yes you do. Check the online help about ON_UPDATE_COMMAND_UI for more info on how to add such handlers.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi all,
I maked a MFC project without Help Support !
So, i made .HLP and .CNT ( a help with index list ! not bad )
i made .HM file, too.
i added .HPJ and .CNT and .RTF and etc to my project, too.
But when i hit F1 button, program show me this error message:
"The topic does not exist. Contact your application vendor for an updated Help file(129)."
Ahhhh, GOD !
Help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
How and where do I cahnge an icon in an SDI app? And am I limited it 16 bit colors?
Derek Smigelski
Dereks@mip.com
|
|
|
|