Click here to Skip to main content
15,884,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTextout() alignment Pin
Anu_Bala21-Apr-10 18:16
Anu_Bala21-Apr-10 18:16 
AnswerRe: Textout() alignment Pin
dtsnagendra21-Apr-10 19:25
dtsnagendra21-Apr-10 19:25 
AnswerRe: Textout() alignment Pin
Richard MacCutchan21-Apr-10 21:01
mveRichard MacCutchan21-Apr-10 21:01 
GeneralRe: Textout() alignment Pin
sgrkadam21-Jul-10 20:48
sgrkadam21-Jul-10 20:48 
GeneralRe: Textout() alignment Pin
Richard MacCutchan21-Jul-10 21:30
mveRichard MacCutchan21-Jul-10 21:30 
QuestionForm View Properties in SplitterWnd Pin
hellogany21-Apr-10 17:26
hellogany21-Apr-10 17:26 
AnswerRe: Form View Properties in SplitterWnd Pin
Richard MacCutchan21-Apr-10 21:04
mveRichard MacCutchan21-Apr-10 21:04 
QuestionMemory leak! Pin
mostafa_pasha21-Apr-10 10:38
mostafa_pasha21-Apr-10 10:38 
Here is a code for create and delete a 3D array!
when i try to catch memory leak by the following code, It alerts that i have exactly 1600 bytes memory leak!
Where is the problem of my Code?

#define VAR_TYPE double

VAR_TYPE ** Create2Darray(int n, int l)
{
	VAR_TYPE **temp = new  VAR_TYPE*[n];
	for (int i =0 ; i< n ; i++) temp[i] = new  VAR_TYPE[l];
	return temp;
}
VAR_TYPE *** Create3DArray(int x,int y,int z)
{
	VAR_TYPE *** arrayd;
	arrayd = new  VAR_TYPE**[x]; 
	for (int i =0 ; i< x ; i++) arrayd[i] = Create2Darray(y,z);
	return arrayd;
}


void Delete3DArray(VAR_TYPE *** darray,int Xdim,int Ydim,int Zdim)
{
	for (int k =0; k<Xdim;k++)
	{
		for (int j=0; j<Ydim;j++)
		{
			delete [] darray[k][j];
			darray[k][j]=NULL;
		}
		delete [] darray[k];
		darray[k] = NULL;
	}
	delete [] darray;
	darray = NULL;
}


//code for detect memory leak

#ifdef _DEBUG
	CMemoryState msOld,msnew, diffMemState;
	msOld.Checkpoint();
	double *** Sample_Temp = Create3DArray(182,218,182);
	Delete3DArray(Sample_Temp,182, 218, 182);

	msnew.Checkpoint();
	if( diffMemState.Difference(msOld, msnew) )
	{
		TRACE( "Memory leaked!\n" );
		diffMemState.DumpStatistics();
	}

#endif 


the output ofter running diffMemState.DumpStatistics() :

Memory leaked!
0 bytes in 0 Free Blocks.
120 bytes in 2 Normal Blocks.
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 57659956 bytes.
Total allocations: 57661556 bytes.

Best,
MJM
AnswerRe: Memory leak! Pin
CPallini21-Apr-10 11:07
mveCPallini21-Apr-10 11:07 
GeneralRe: Memory leak! Pin
mostafa_pasha21-Apr-10 11:13
mostafa_pasha21-Apr-10 11:13 
GeneralRe: Memory leak! Pin
CPallini21-Apr-10 11:26
mveCPallini21-Apr-10 11:26 
GeneralRe: Memory leak! Pin
mostafa_pasha21-Apr-10 19:42
mostafa_pasha21-Apr-10 19:42 
GeneralRe: Memory leak! Pin
cmk21-Apr-10 13:45
cmk21-Apr-10 13:45 
AnswerRe: Memory leak! Pin
«_Superman_»21-Apr-10 12:10
professional«_Superman_»21-Apr-10 12:10 
AnswerRe: Memory leak! Pin
Adam Roderick J21-Apr-10 17:59
Adam Roderick J21-Apr-10 17:59 
QuestionHow do I check syntax in Visual Studio 2008? Pin
Member 86892621-Apr-10 8:36
Member 86892621-Apr-10 8:36 
GeneralRe: How do I check syntax in Visual Studio 2008? Pin
David Crow21-Apr-10 8:55
David Crow21-Apr-10 8:55 
GeneralRe: How do I check syntax in Visual Studio 2008? Pin
«_Superman_»21-Apr-10 9:05
professional«_Superman_»21-Apr-10 9:05 
QuestionRe: How do I check syntax in Visual Studio 2008? Pin
David Crow21-Apr-10 9:08
David Crow21-Apr-10 9:08 
JokeRe: How do I check syntax in Visual Studio 2008? Pin
«_Superman_»21-Apr-10 10:12
professional«_Superman_»21-Apr-10 10:12 
AnswerRe: How do I check syntax in Visual Studio 2008? Pin
Iain Clarke, Warrior Programmer21-Apr-10 9:50
Iain Clarke, Warrior Programmer21-Apr-10 9:50 
QuestionMigrating code from VS6 to vs 2008 [modified] - SOLVED Pin
Jim Crafton21-Apr-10 6:46
Jim Crafton21-Apr-10 6:46 
QuestionDefining a second window class in in MFC app for a CDialog Pin
ForNow21-Apr-10 6:40
ForNow21-Apr-10 6:40 
AnswerRe: Defining a second window class in in MFC app for a CDialog Pin
«_Superman_»21-Apr-10 7:41
professional«_Superman_»21-Apr-10 7:41 
GeneralRe: Defining a second window class in in MFC app for a CDialog Pin
ForNow21-Apr-10 7:44
ForNow21-Apr-10 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.