|
Who said I didn't do it? I'm a c++ programmer.
class myclass
{
int* a;
int* b;
myclass()
{
a= NULL;
b= NULL;
}
}
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Your code said it.
Anyway, I think it is pretty important to show it in the code as well.
|
|
|
|
|
Hi Hamid,
I am confused. My question is about whether we need to delete a or b if bad_alloc happens, does your reply has anything related to my question?
regards,
George
|
|
|
|
|
My reply was for check does it with success or no (and my suggestion is when you want to allocate or convert use of try/catch block) and when you got error means that it doesnt allocate any thing to variable.
|
|
|
|
|
Thanks Hamid,
I have developed a couple of samples, which specific case do you think I need to check?
regards,
George
|
|
|
|
|
If you check each block of your program(for exmaple is hwnd valid,etc) you can almost(not always) sure that you didnt get an exception when you run your program
|
|
|
|
|
Hi Hamid,
How could I check manually which block is exception safe or not? There are too many runtime errors, like out of memory or input invalid values to new which will cause bad_alloc.
regards,
George
|
|
|
|
|
Well its simple you know some actions will be problem and you can anticipate them a short list like:
(1) When you want to read a file or write a file:1-does file exist 2-does this file open with other programs 3- can you write to a file on the cd or no,does file on the floppy drive and does it write-protected or no
(2) Database do you have access to database
(3) when you need to a handle to a window does return value valid or its null
(4) Picture does file a image file or no what was return value
(5) when you want to read of internet do you have any connection to internet
(6) do you have a valid pointer or its null
(7) Dynamic memory,does it valid
(8)....
------------------------------
After all of them you must free memory.
|
|
|
|
|
Thanks Hamid,
Comprehensive samples.
regards,
George
|
|
|
|
|
I glad I could help to you.
|
|
|
|
|
Thanks Hamid,
Hope we can have further discussion here -- other topics -- I will find one soon.
regards,
George
|
|
|
|
|
Very good.
|
|
|
|
|
I remember when use of controls and other objects check memory for size of program.
|
|
|
|
|
Hi Hamid,
Is your comment related to my original question? My question is not talking about windows controls.
regards,
George
|
|
|
|
|
No I think its helpful if you know.
|
|
|
|
|
Hi Hamid,
I am interested. What do you mean "check memory size of a program"? Could you provide some samples or links or more descriptions please?
regards,
George
|
|
|
|
|
My intent is when run your program monitor memory for detaily of your program.
|
|
|
|
|
Thanks Hamid,
You mean in the current process, monitor the memory consumed by current process? And what is its purpose? If you have some links or samples, it will be better to understand your points.
regards,
George
|
|
|
|
|
When run your program use of performance for check behavior of your program its good.
|
|
|
|
|
How to check in your experience? Any tool? API? Samples?
regards,
George
|
|
|
|
|
I said previous Performance is good and exist on your system whats your OS?
|
|
|
|
|
Thanks Hamid,
I am using Windows Server 2003. I always want to improve performance. I am using Visual Studio 2005/2008 to develop C++ application.
What are the tools/experiences you had before?
regards,
George
|
|
|
|
|
Im using of Task Manager and performance.
|
|
|
|
|
Hi Hamid,
Thanks for sharing the information. If you are using Task Manager, I have a question, what means "PF" (in Windows Server 2003 Task Manager)? The same as physical memory?
regards,
George
|
|
|
|
|
This is form Task manager's help about PF Usage:
The amount of paging file being used by the system.
|
|
|
|