|
The system, on a regular x86 installation of Windows, will be unable to load an image that large because it will run out of virtual address space in the process.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Maximilien wrote:
you mean your exe file is 2gig ?
I think he's saying his single-image setup.exe is > 2 gig...
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
Hello,
If the exact size of the executable is more than 2GB the problem can be that windows has not enough adress space left to create a heap and / or a stack. I don't know if the linker will complain about having not enough adress space left...
But honestly, what were you thinking when you made that 1.5GB jumbo executable 500MB bigger? Like other people mentioned, you should try and put some of those MB's in a separate file.
I also got the blogging virus..[^]
|
|
|
|
|
Thanks for the comments.
My executable contains data to create a DVD movie. Its something like packing all data inside the executable and on execution it creates a DVD movie with the data it hosts. Its not a setup exe. I cannot put the data in seperate files. It has to be one single executable.
When the exe was 2 GB, it didn't issue any sys warning or error message, but a application error saying the header could not be read. I think the Loader didnot create the executable fully/properly. But with 1.5 GB data, it worked fine.
Vini
|
|
|
|
|
2GB executable file.
You must be kidding ...
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
Rahim Rattani wrote:
You must be kidding ...
No I am not.
Vini
|
|
|
|
|
Hi,
I have an application (in VC++ 6.0) wherein it displays the images in ListView. So the application starts displaying the images from the Top left corner (0,0).
Now I have added the manifest file (to give XP look to application) in applicatoin resource successfully. (as outlined in the below mentioned link http://www.codeguru.com/Cpp/controls/controls/article.php/c5227/[^])
The application is having the XP look but the images are displayed from the Bottom left corner.
Question:How to set the origin of the ListCtrl to top left corner (0,0) so that the images are displayed from the top left corner (0,0) ?
Thanks & Regards,
Neeraj
|
|
|
|
|
Hi,
Is there any C++ CLASS/API similar to JAVA "HttpURLConnection" .
Pls help
Thnaks
Ram
|
|
|
|
|
|
Hi,
I have a ActiveX component (3th party) in my own MFC project (Dialog, shared). If i run the project in developers studio i see some logging comming from the ActiveX component.
Now i want to write this logging to a file, without using developers studio. Somehow i don't get it to work. I tried to reroute the stdout/stderr stream, also the _CrtSetReportHook2 catches a lot...but not the activex logging.
Has anybody a idea how to get it done?
Many thanx,
Richard
|
|
|
|
|
Hi everyone!
My name's Duc , I'm from Vienam and I'm a student . I've just used
MFC(VC6.0).I think memory allocation is very important in programming,isn't it? I've tried to search in MSDN but it's not clear!So I want to ask you some question in my situation :
I have a class T which has a default destructor does nothing . T also
has a member variable : char *str; and a constructor :
T::T()
{
str=new char[200];
}
I allocate an object of class T in function f() by the new
operator like this :
void f()
{
T* pT=new T();
}
The question is : Will the memmory block(contains 200 bytes of str)
which is pointed to by pT be free(deallocated) when we leave the function
f()?What happens inside (when deallocating)?
Thank you for your listening and help!
Ky
|
|
|
|
|
HoDuc wrote:
I think memory allocation is very important in programming,isn't it
Yes, you can quickly go into real troubles
Ok, in your case, the memory allocated for your string won't be freed in your program. You need to free it in the destructor of your class:
T::~T()<br />
{<br />
if(str)<br />
{<br />
delete[] str;<br />
str = NULL;<br />
}<br />
}
[EDIT] Ok, I read your post a little bit to fast. One think that is really really important is that each new must have a corresponding delete to free the memory allocated by new. In your case, if you create a new object in your function, it won't be deleted automatically when leaving the function so you will first need to delete it. When deleting an object, this will automatically call the destructor of your class. And inside this destructor, you will free the memory allocated for your string. Easy, isn't it ? [\EDIT]
|
|
|
|
|
Ok, I will go a little bit deeper in details. It's true that it is a part that is not easy to understand at the begining.
The destructor of a class is there to free the memory that has been dynamically allocated (so with a new) for one or several member variables of your class (could do other things also but here we will just speak about the memory management). This is typically the place where you need to put the delete of str in your example. Even if the variable has not been allocated in the constructor for example !!
A good way of working is that if you don't allocate memory in the constructor for a pointer of your class, make it NULL:
T::T()<br />
{<br />
str = NULL;<br />
}
Thus, when you destructor will be called, you can check if this memory has been allocated or not and free it in the first case:
T::~T()<br />
{<br />
if(str)<br />
{<br />
delete[] str;<br />
str = NULL;<br />
}<br />
}
So, now when is the destructor of a class called ? Simple: whenever the object is being destroyed. By destroyed I mean not only when calling delete but also when your object (not allocated by new) goes out of scope. Example:
int foo()<br />
{<br />
T Object;<br />
....<br />
....<br />
return 0;<br />
}
In this case, your object has not been allocated dynamically but its destructor is called when the object is destroyed (leaving the function).
I hope this is a little bit clearer ? If you have further questions, do ask
|
|
|
|
|
HoDuc wrote:
Will the memmory block(contains 200 bytes of str)
which is pointed to by pT be free(deallocated) when we leave the function
no, it will free when a call of delete[] occurs, of when main leaves (and so, the system destroys the array)
HoDuc wrote:
What happens inside (when deallocating)?
if calls the destructors of each object in the tab before freeing the memory space... (soory, wrong)
it free the memory, even though the objects were "destructed"
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
T::T()
{str=new char[200];
}
void f()
{T* pT=new T();//no need to mention braces
}
in destructor u do the opposite of u did in CONSTRUCTOR
SO MENTION A DESTRUCTOR
T:~T()
{delete[] str;
}
in the void f()
delete pT; //mention in the f() where u dont require the
//pointer usually at the end of f()
which will call the above destructor
|
|
|
|
|
sunit5 wrote:
in destructor u do the opposite of u did in CONSTRUCTOR
No, not necessarily !! If you allocated your str elsewhere than in your constructor (and it happens very very often for me), you will have a memory leak then, because if I follow your rule, it won't be delete then...
Another thing: make 'safe destructions' before deleting an object, check if the pointer is not NULL, then delete the object and after that make it NULL (not really necessary but better be too much protective than the opposite ). And also, if your pointer is not allocated in the constructor, make it NULL so if it has not been yet allocated when your object is destroyed, it will not be deleted (and the opposite will result of a very very bad error message ).
So, a general rule I follow in my destructor: use this safe destruction for all pointers in your object and this is ok.
|
|
|
|
|
There is no point in part one of your safe destruction idea. The C++ delete operator takes care of the case where the pointer is NULL. So delete(NULL) is legal and does nothing. I do agree with your other ideas though, they are very helpful. Especially the bit about setting pointers to NULL on initialization..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I had serious doubts about your statement, "The C++ delete operator takes care of the case where the pointer is NULL." So I did some digging in the CRT library source. It turns out that this statement is not totally correct. The C++ delete operator just ends up calling _free_dbg and that checks for a null pointer. In the end the null pointer is caught though and that is the bottom line.
|
|
|
|
|
Rick York wrote:
I had serious doubts about your statement, "The C++ delete operator takes care of the case where the pointer is NULL." So I did some digging in the CRT library source. It turns out that this statement is not totally correct. The C++ delete operator just ends up calling _free_dbg and that checks for a null pointer. In the end the null pointer is caught though and that is the bottom line.
The C++ standard dictates that the delete operator must handle a NULL pointer being passed to it correctly. It makes no difference where, it will always be the case for a reasonably standards-compliant compiler/library (I don't know of any which don't obey this)
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I checked VC++ 7.1's CRT implementation, it does check for NULL and return immediately (dbgdel.cpp, line 42). What compiler are you using?
I think it is just an inefficient implementation of the standard. The C++ standard pretty clearly says that the delete operator must handle the NULL pointer case.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi all
In my dialog, i've many objects that are a RichEditCtrl, an some buttons.
I create with ClassWizard to add OnNotify in my app.
BOOL CCEdataTextEditorDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) <br />
{<br />
if( wParam == IDC_RICH )
{<br />
MessageBox("Non");
}<br />
MessageBox("hic");
<br />
return CDialog::OnNotify(wParam, lParam, pResult);<br />
}
But i get nothing!!
plz, help me! thanks for all
hzocm
|
|
|
|
|
Just to confirm... you are definitly getting no notifications? For example - try typing something, then select some of the text you typed. The selecting sould generate a notification event.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
no, there are nothing!
u know, in the end, that means after if (wParam == IDC_RICH){...} , we've MessageBox("blabla")
but it doesn't launch!
plz, help me!!
hzocm
|
|
|
|
|
Another possibility is that the notification messages are only routed to the specific event handlers. If you look in the class wizard, you should see events that are associated with this control only. Try adding handlers for these, and see if you get any luck.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|