Click here to Skip to main content
15,886,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I use C# Managed DLL into VC++ Application Pin
Stuart Dootson29-Apr-09 20:50
professionalStuart Dootson29-Apr-09 20:50 
GeneralRe: How can I use C# Managed DLL into VC++ Application Pin
PankajB29-Apr-09 20:53
PankajB29-Apr-09 20:53 
Questionbest font for hindi Pin
Purish Dwivedi29-Apr-09 20:15
Purish Dwivedi29-Apr-09 20:15 
AnswerRe: best font for hindi Pin
CPallini29-Apr-09 21:09
mveCPallini29-Apr-09 21:09 
GeneralRe: best font for hindi Pin
Purish Dwivedi29-Apr-09 22:00
Purish Dwivedi29-Apr-09 22:00 
AnswerRe: best font for hindi Pin
Michael Schubert29-Apr-09 22:05
Michael Schubert29-Apr-09 22:05 
AnswerRe: best font for hindi Pin
Rajesh R Subramanian29-Apr-09 22:15
professionalRajesh R Subramanian29-Apr-09 22:15 
QuestionVisualC++ LineTo() call causes high usage of resouce, causing more RAM usage - Memory Not Releasing Pin
adepumadhu129-Apr-09 20:15
adepumadhu129-Apr-09 20:15 
When VC++ "LineTo" statement is called very often (say every 100 ms), it is using more resource and it is not getting released. If my application is running for longer period (say 2 hours), high usage of resource problem causing more RAM usage and memory is not getting released and growing continuously.

Sample code is given below (Please send your personal email id, so that I can email complete code)

//------------------------------------------------------------------

//Callback method creation (100 ms)
m_nEventID = timeSetEvent(100,0,GeneratePeriodicCall,DWORD(this),TIME_PERIODIC);


//callback method
void CALLBACK GeneratePeriodicCall(UINT uID, UINT UMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
CTestAppView* pView = (CTestAppView*) dwUser;

//kill thread if active
if(g_hDrawChartThread != INVALID_HANDLE_VALUE)
{
DWORD dwExitCode =NULL;

DWORD dw = NULL;

GetExitCodeThread(g_hDrawChartThread, &dwExitCode);

if(dwExitCode == STILL_ACTIVE)
{
::CloseHandle(g_hDrawChartThread);

g_hDrawChartThread = NULL;
}
else
{
g_hDrawChartThread = NULL;
}
}

//create thread
g_hDrawChartThread = CreateThread(NULL,0,DrawChart,pView,0,0);
}


//Thread call
DWORD __stdcall DrawChart(LPVOID lParam)
{
CTestAppView* pView = (CTestAppView*)lParam;

CClientDC dc(pView);

int nSaveDC = dc.SaveDC();

long x = 0;

long y = 0;

for(long i = 0 ; i < 100000 ;i++)
{
dc.MoveTo(x,y);

//THIS LINE IS CAUSING SERIOUS RESOURCE LEAK
dc.LineTo(x + 1, y + 1);

x = x + 1;

y = y + 1;
}

dc.RestoreDC(nSaveDC);

return 0;
}
//------------------------------------------------------------------

Anyone can clarify me why "LineTo()" is not releasing resources & utilising more RAM. This RAM memory is not getting released until unless I close my VC++ application.

Any solution/hint, welcome.

Thanks in advance,
Madhu
AnswerRe: VisualC++ LineTo() call causes high usage of resouce, causing more RAM usage - Memory Not Releasing Pin
Cedric Moonen29-Apr-09 20:26
Cedric Moonen29-Apr-09 20:26 
AnswerRe: VisualC++ LineTo() call causes high usage of resouce, causing more RAM usage - Memory Not Releasing Pin
Perry Holman29-Apr-09 22:12
Perry Holman29-Apr-09 22:12 
QuestionRe: VisualC++ LineTo() call causes high usage of resouce, causing more RAM usage - Memory Not Releasing Pin
David Crow30-Apr-09 4:12
David Crow30-Apr-09 4:12 
QuestionNeed help on finishing this basic C program [modified] Pin
biggiant2200029-Apr-09 19:35
biggiant2200029-Apr-09 19:35 
AnswerRe: Need help on finishing this basic C program Pin
_AnsHUMAN_ 29-Apr-09 19:57
_AnsHUMAN_ 29-Apr-09 19:57 
GeneralRe: Need help on finishing this basic C program Pin
biggiant220001-May-09 6:29
biggiant220001-May-09 6:29 
AnswerRe: Need help on finishing this basic C program Pin
Michael Schubert29-Apr-09 22:12
Michael Schubert29-Apr-09 22:12 
QuestionRe: Need help on finishing this basic C program Pin
David Crow30-Apr-09 4:26
David Crow30-Apr-09 4:26 
AnswerRe: Need help on finishing this basic C program Pin
biggiant220001-May-09 6:07
biggiant220001-May-09 6:07 
QuestionRe: Need help on finishing this basic C program Pin
David Crow1-May-09 6:10
David Crow1-May-09 6:10 
QuestionMultithreading help in C++ Pin
Kiran Satish29-Apr-09 16:59
Kiran Satish29-Apr-09 16:59 
AnswerRe: Multithreading help in C++ Pin
Stuart Dootson29-Apr-09 20:48
professionalStuart Dootson29-Apr-09 20:48 
GeneralRe: Multithreading help in C++ Pin
Kiran Satish30-Apr-09 5:15
Kiran Satish30-Apr-09 5:15 
GeneralRe: Multithreading help in C++ Pin
Stuart Dootson30-Apr-09 6:16
professionalStuart Dootson30-Apr-09 6:16 
GeneralRe: Multithreading help in C++ Pin
Kiran Satish30-Apr-09 6:50
Kiran Satish30-Apr-09 6:50 
GeneralRe: Multithreading help in C++ Pin
Stuart Dootson30-Apr-09 6:55
professionalStuart Dootson30-Apr-09 6:55 
AnswerRe: Multithreading help in C++ Pin
KarstenK29-Apr-09 21:17
mveKarstenK29-Apr-09 21:17 

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.