473,378 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

thread slowing down so much

Hi,

I am writing a C# program that is calling C++ legacy code.
I wrote a C++ managed wrapper for this legacy code.
It seems to work well.
The legacy code is handling serial (RS232 or RS422) lines.
To keep a serial line "alive", i have to call regularly a function.
A c# thread is calling about every 25 ms this function (based on
"WaitOne (25, false)" function).
Usually, this function is called every 30 ms.
But after a while (about 30 minutes), this function is called after a
few hundreds of ms or even a few seconds !
I know Windows is not a real time OS and some background processes can
be run by DotNet runtime like garbage collection but still !

I use heavily Debug.Writeline to trace my program.
I run the debug version of my program outside of Visual Studio
environment.
This morning, I had a log of 1,7 GB for about 16 hours of test running.
Analysing it, I saw no log during 1 minute 38 seconds.
It means also no log from other C# threads, 100% C# managed !
Usually, I have about 400 log lines/second.

What's going on ?
The deadline is coming for this program, please help me.

My configuration :

Pentium 4 2.8 GHz HyperTheading
512 MB RAM
Windows XP Professional SP1
Visual Studio 2003 v 7.1.3088
DotNet Framework 1.1 v 1.1.4322

Thanks in advance,

Droopy.

Nov 17 '05 #1
5 1734
Droopy,

It looks like you are using a class that is a managed wrapper around an
unmanaged resource. Are you sure you are disposing of the resource
properly?

Can you show the code?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Droopy" <dr**************@hotmail.com> wrote in message
news:Xn**********************************@195.129. 110.71...
Hi,

I am writing a C# program that is calling C++ legacy code.
I wrote a C++ managed wrapper for this legacy code.
It seems to work well.
The legacy code is handling serial (RS232 or RS422) lines.
To keep a serial line "alive", i have to call regularly a function.
A c# thread is calling about every 25 ms this function (based on
"WaitOne (25, false)" function).
Usually, this function is called every 30 ms.
But after a while (about 30 minutes), this function is called after a
few hundreds of ms or even a few seconds !
I know Windows is not a real time OS and some background processes can
be run by DotNet runtime like garbage collection but still !

I use heavily Debug.Writeline to trace my program.
I run the debug version of my program outside of Visual Studio
environment.
This morning, I had a log of 1,7 GB for about 16 hours of test running.
Analysing it, I saw no log during 1 minute 38 seconds.
It means also no log from other C# threads, 100% C# managed !
Usually, I have about 400 log lines/second.

What's going on ?
The deadline is coming for this program, please help me.

My configuration :

Pentium 4 2.8 GHz HyperTheading
512 MB RAM
Windows XP Professional SP1
Visual Studio 2003 v 7.1.3088
DotNet Framework 1.1 v 1.1.4322

Thanks in advance,

Droopy.

Nov 17 '05 #2
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in news:#U**************@TK2MSFTNGP15.phx.gbl:
Droopy,

It looks like you are using a class that is a managed wrapper
around an
unmanaged resource. Are you sure you are disposing of the resource
properly?

Can you show the code?


No I am not sure.
It is the first time I mix managed and unmanaged code.

Here is the code for the "keep alive" thread :

the C# thread function :

public void ItTaskProc ()
{
Util.TraceOther ("ItTaskProc thread started");

TimeSpan maxItTaskElapsedTime = TimeSpan.MinValue;
TimeSpan minItTaskElapsedTime = TimeSpan.MaxValue;
DateTime dtCurrent = DateTime.Now;
DateTime dtLast = DateTime.MinValue;

try
{
while (true)
{
Util.TraceOther ("before WaitOne");
if (_itTaskEvent.WaitOne (25, false))
{
Util.TraceOther ("ItTaskProc end asked");
break;
}
Util.TraceOther ("after WaitOne");
Util.TraceOther ("before ItTask");
ItTask ();
Util.TraceOther ("after ItTask");

dtLast = dtCurrent;
dtCurrent = DateTime.Now;

TimeSpan diff = dtCurrent.Subtract (dtLast);
if (minItTaskElapsedTime > diff)
{
minItTaskElapsedTime = diff;
Util.TraceOther ("New mininimum ItTaskElapsedTime =
" + minItTaskElapsedTime);
}
if (maxItTaskElapsedTime < diff)
{
maxItTaskElapsedTime = diff;
Util.TraceOther ("New maximum ItTaskElapsedTime =
" + maxItTaskElapsedTime);
}
}
}
catch (Exception ex)
{
Util.TraceError ("ItTaskProc: Exception catched: " + ex);
EventArgs ea = new EventArgs ();
if (OnConnectionFailed != null)
OnConnectionFailed (this, ea);
}
finally
{
_itTaskEvent.Reset ();
}
Util.TraceOther ("ItTaskProc ended gracefully");
}
calling this c# function where "_transport" is an instance of the C++
managed wrapper :

public void ItTask ()
{
_transport.ItTask ();
}

here it is the C++ managed function that is calling the C++ unmanaged
wrapper called "_unmanaged" (not really a wrapper because the C++ unmanaged
class is a subclass of the C++ legacy entry point) :

void TrspPortManaged::ItTask ()
{
_unmanaged->ItTask ();
}

here is the C++ unmanaged function where EnterCS and LeaveCS handle
critical sections shared with legacy code :

void UMTrspPort::ItTask( void)
{
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask before ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

cTrspPort::ItTask ();

Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask after ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
}

I don't think there is a disposing problem in this "keep alive thread".

Here is the declaration for the unmanaged C++ class, subclass from the C++
unmanaged legacy code class called "cTrspPort" :

class UMTrspPort : public cTrspPort
{
private:
char _bufIn __nogc [260];
unsigned short _size;
PFUNC _pCallback;

public:
UMTrspPort ();
void AddCallback (PFUNC pCallback);
void TraceLine (String *message);
void TraceError (String *message);
// Virtuals

//
================================================== =========================
=
// vpFreeMsg
// Ask memory buffer for incoming data
//
================================================== =========================
=
virtual void * vpFreeMsg (unsigned short NbByte);

//
================================================== =========================
=
// vMsgIn
// new incoming message
// returns 0 if OK.
//
================================================== =========================
=
virtual unsigned char vMsgIn (int MsgOk);

// outgoing message sent
virtual void vMsgOut (unsigned long Tag, unsigned short Err);

// no added value, redefined to add critical section
void ItTask( void);

// no added value, redefined to add critical section
unsigned short MsgOut (void *pMsg, unsigned long NbByte, unsigned
long Tag);
};

If there is a disposing problem, it should be in incoming or outgoing
message functions here above :

vpFreeMsg is called by legacy code to get a buffer to copy incoming data :

void * UMTrspPort::vpFreeMsg (unsigned short NbByte)
{
_size = NbByte;
char *ptr = _bufIn;
return ((void *) ptr);
}

vMsgIn is called by legacy code when there is incoming data :

unsigned char UMTrspPort::vMsgIn (int MsgOk)
{
CommEventData *data = new CommEventData ();
data->EventType = CommEventType::Session;
data->UcnData = new unsigned char __gc [_size];
Marshal::Copy (_bufIn, data->UcnData, 0, _size);

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgIn no callback defined");

return 0;
}

MsgOut is called by legacy code to send outgoing data :

unsigned short UMTrspPort::MsgOut (void *pMsg, unsigned long NbByte,
unsigned long Tag)
{
char *pm = (char *) pMsg;
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

unsigned short retCode = cTrspPort::MsgOut (pMsg, NbByte, Tag);

Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

return retCode;
}

vMsgOut is called by legacy code when outgoing data is really sent

void UMTrspPort::vMsgOut (unsigned long Tag, unsigned short Err)
{
if (Err != 0)
{
TraceError (String::Format ("UMTrspPort::vMsgOut Tag={0}, Err=
0x{1}", Tag.ToString (), Err.ToString (S"X2")));
}

CommEventData *data = new CommEventData ();

data->EventType = CommEventType::vMsgOut;
data->UlData = Tag;

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgOut no callback defined");
}
Sorry, it is a lot of code but I give you only the minimum.
Thanks for your answer,

Droopy.

Nov 17 '05 #3
Please give me a clue !
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote in news:#U**************@TK2MSFTNGP15.phx.gbl:
Droopy,

It looks like you are using a class that is a managed wrapper
around an
unmanaged resource. Are you sure you are disposing of the resource
properly?

Can you show the code?
No I am not sure.
It is the first time I mix managed and unmanaged code.

Here is the code for the "keep alive" thread :

the C# thread function :

public void ItTaskProc ()
{
Util.TraceOther ("ItTaskProc thread started");

TimeSpan maxItTaskElapsedTime = TimeSpan.MinValue;
TimeSpan minItTaskElapsedTime = TimeSpan.MaxValue;
DateTime dtCurrent = DateTime.Now;
DateTime dtLast = DateTime.MinValue;

try
{
while (true)
{
Util.TraceOther ("before WaitOne");
if (_itTaskEvent.WaitOne (25, false))
{
Util.TraceOther ("ItTaskProc end asked");
break;
}
Util.TraceOther ("after WaitOne");
Util.TraceOther ("before ItTask");
ItTask ();
Util.TraceOther ("after ItTask");

dtLast = dtCurrent;
dtCurrent = DateTime.Now;

TimeSpan diff = dtCurrent.Subtract (dtLast);
if (minItTaskElapsedTime > diff)
{
minItTaskElapsedTime = diff;
Util.TraceOther ("New mininimum ItTaskElapsedTime
=
" + minItTaskElapsedTime);
}
if (maxItTaskElapsedTime < diff)
{
maxItTaskElapsedTime = diff;
Util.TraceOther ("New maximum ItTaskElapsedTime =
" + maxItTaskElapsedTime);
}
}
}
catch (Exception ex)
{
Util.TraceError ("ItTaskProc: Exception catched: " + ex);
EventArgs ea = new EventArgs ();
if (OnConnectionFailed != null)
OnConnectionFailed (this, ea);
}
finally
{
_itTaskEvent.Reset ();
}
Util.TraceOther ("ItTaskProc ended gracefully");
}
calling this c# function where "_transport" is an instance of the C++
managed wrapper :

public void ItTask ()
{
_transport.ItTask ();
}

here it is the C++ managed function that is calling the C++ unmanaged
wrapper called "_unmanaged" (not really a wrapper because the C++
unmanaged class is a subclass of the C++ legacy entry point) :

void TrspPortManaged::ItTask ()
{
_unmanaged->ItTask ();
}

here is the C++ unmanaged function where EnterCS and LeaveCS handle
critical sections shared with legacy code :

void UMTrspPort::ItTask( void)
{
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask before ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

cTrspPort::ItTask ();

Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask after ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
}

I don't think there is a disposing problem in this "keep alive
thread".

Here is the declaration for the unmanaged C++ class, subclass from the
C++ unmanaged legacy code class called "cTrspPort" :

class UMTrspPort : public cTrspPort
{
private:
char _bufIn __nogc [260];
unsigned short _size;
PFUNC _pCallback;

public:
UMTrspPort ();
void AddCallback (PFUNC pCallback);
void TraceLine (String *message);
void TraceError (String *message);
// Virtuals

//
================================================== ====================

= ==== =
// vpFreeMsg
// Ask memory buffer for incoming data
//
================================================== ==================== = ==== =
virtual void * vpFreeMsg (unsigned short NbByte);

//
================================================== ==================== = ==== =
// vMsgIn
// new incoming message
// returns 0 if OK.
//
================================================== ==================== = ==== =
virtual unsigned char vMsgIn (int MsgOk);

// outgoing message sent
virtual void vMsgOut (unsigned long Tag, unsigned short Err);

// no added value, redefined to add critical section
void ItTask( void);

// no added value, redefined to add critical section
unsigned short MsgOut (void *pMsg, unsigned long NbByte, unsigned
long Tag);
};

If there is a disposing problem, it should be in incoming or outgoing
message functions here above :

vpFreeMsg is called by legacy code to get a buffer to copy incoming
data :

void * UMTrspPort::vpFreeMsg (unsigned short NbByte)
{
_size = NbByte;
char *ptr = _bufIn;
return ((void *) ptr);
}

vMsgIn is called by legacy code when there is incoming data :

unsigned char UMTrspPort::vMsgIn (int MsgOk)
{
CommEventData *data = new CommEventData ();
data->EventType = CommEventType::Session;
data->UcnData = new unsigned char __gc [_size];
Marshal::Copy (_bufIn, data->UcnData, 0, _size);

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgIn no callback defined");

return 0;
}

MsgOut is called by legacy code to send outgoing data :

unsigned short UMTrspPort::MsgOut (void *pMsg, unsigned long NbByte,
unsigned long Tag)
{
char *pm = (char *) pMsg;
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

unsigned short retCode = cTrspPort::MsgOut (pMsg, NbByte, Tag);

Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

return retCode;
}

vMsgOut is called by legacy code when outgoing data is really sent

void UMTrspPort::vMsgOut (unsigned long Tag, unsigned short Err)
{
if (Err != 0)
{
TraceError (String::Format ("UMTrspPort::vMsgOut Tag={0},
Err=
0x{1}", Tag.ToString (), Err.ToString (S"X2")));
}

CommEventData *data = new CommEventData ();

data->EventType = CommEventType::vMsgOut;
data->UlData = Tag;

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgOut no callback defined");
}
Sorry, it is a lot of code but I give you only the minimum.
Thanks for your answer,

Droopy.


Nov 17 '05 #4
I check for memory leak with a memory profiler.
Did not find memory link in my code but it seems there are memory links
in the String usage made when logging => I disabled tracing and then ...
no problem !
So it seems I have to make a refactoring in my logging routines because
I still use "Debug.WriteLine".

Besides, I cannot compile a "Release" version.
In Debug mode, I had a linker error LNK4210 that I solved using the MSDN
article #814472.

In Release mode, I have following errors :

with /MD parameter :

3 errors LNK2001 ("__argc", "__argv", "__mbctype")
4 errors LNK2005 ("delete" + "new") for msvcrt.lib (MSVCC71.dll)
1 error LNK2019 __mbctype referenced in function "void __stdcall
_AfxAbbreviateName ..."

with /MT parameter :

2 errors LNK2005 for libcmt.lib (typinfo.obj)
10 errors LNK2005 for msvcrt.lib (MSVCC71.dll)
4 errors LNK2005 for msvcrt.lib (cinitexe.obj)
1 error LNK2019

Thanks in advance for your help.

Please give me a clue !
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
wrote in news:#U**************@TK2MSFTNGP15.phx.gbl:
Droopy,

It looks like you are using a class that is a managed wrapper
around an
unmanaged resource. Are you sure you are disposing of the resource
properly?

Can you show the code?
No I am not sure.
It is the first time I mix managed and unmanaged code.

Here is the code for the "keep alive" thread :

the C# thread function :

public void ItTaskProc ()
{
Util.TraceOther ("ItTaskProc thread started");

TimeSpan maxItTaskElapsedTime = TimeSpan.MinValue;
TimeSpan minItTaskElapsedTime = TimeSpan.MaxValue;
DateTime dtCurrent = DateTime.Now;
DateTime dtLast = DateTime.MinValue;

try
{
while (true)
{
Util.TraceOther ("before WaitOne");
if (_itTaskEvent.WaitOne (25, false))
{
Util.TraceOther ("ItTaskProc end asked");
break;
}
Util.TraceOther ("after WaitOne");
Util.TraceOther ("before ItTask");
ItTask ();
Util.TraceOther ("after ItTask");

dtLast = dtCurrent;
dtCurrent = DateTime.Now;

TimeSpan diff = dtCurrent.Subtract (dtLast);
if (minItTaskElapsedTime > diff)
{
minItTaskElapsedTime = diff;
Util.TraceOther ("New mininimum ItTaskElapsedTime
=
" + minItTaskElapsedTime);
}
if (maxItTaskElapsedTime < diff)
{
maxItTaskElapsedTime = diff;
Util.TraceOther ("New maximum ItTaskElapsedTime =
" + maxItTaskElapsedTime);
}
}
}
catch (Exception ex)
{
Util.TraceError ("ItTaskProc: Exception catched: " + ex);
EventArgs ea = new EventArgs ();
if (OnConnectionFailed != null)
OnConnectionFailed (this, ea);
}
finally
{
_itTaskEvent.Reset ();
}
Util.TraceOther ("ItTaskProc ended gracefully");
}
calling this c# function where "_transport" is an instance of the C++
managed wrapper :

public void ItTask ()
{
_transport.ItTask ();
}

here it is the C++ managed function that is calling the C++ unmanaged
wrapper called "_unmanaged" (not really a wrapper because the C++
unmanaged class is a subclass of the C++ legacy entry point) :

void TrspPortManaged::ItTask ()
{
_unmanaged->ItTask ();
}

here is the C++ unmanaged function where EnterCS and LeaveCS handle
critical sections shared with legacy code :

void UMTrspPort::ItTask( void)
{
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask before ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

cTrspPort::ItTask ();

Debug::WriteLine
(String::Format (S"{0} - UMTrspPort::ItTask after ItTask",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::ItTask after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
}

I don't think there is a disposing problem in this "keep alive
thread".

Here is the declaration for the unmanaged C++ class, subclass from the C++ unmanaged legacy code class called "cTrspPort" :

class UMTrspPort : public cTrspPort
{
private:
char _bufIn __nogc [260];
unsigned short _size;
PFUNC _pCallback;

public:
UMTrspPort ();
void AddCallback (PFUNC pCallback);
void TraceLine (String *message);
void TraceError (String *message);
// Virtuals

//
================================================== ==================== =
==== =
// vpFreeMsg
// Ask memory buffer for incoming data
//
================================================== ==================== =
==== =
virtual void * vpFreeMsg (unsigned short NbByte);

//
================================================== ==================== =
==== =
// vMsgIn
// new incoming message
// returns 0 if OK.
//
================================================== ==================== =
==== =
virtual unsigned char vMsgIn (int MsgOk);

// outgoing message sent
virtual void vMsgOut (unsigned long Tag, unsigned short Err);

// no added value, redefined to add critical section
void ItTask( void);

// no added value, redefined to add critical section
unsigned short MsgOut (void *pMsg, unsigned long NbByte,

unsigned long Tag);
};

If there is a disposing problem, it should be in incoming or outgoing
message functions here above :

vpFreeMsg is called by legacy code to get a buffer to copy incoming
data :

void * UMTrspPort::vpFreeMsg (unsigned short NbByte)
{
_size = NbByte;
char *ptr = _bufIn;
return ((void *) ptr);
}

vMsgIn is called by legacy code when there is incoming data :

unsigned char UMTrspPort::vMsgIn (int MsgOk)
{
CommEventData *data = new CommEventData ();
data->EventType = CommEventType::Session;
data->UcnData = new unsigned char __gc [_size];
Marshal::Copy (_bufIn, data->UcnData, 0, _size);

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgIn no callback defined");

return 0;
}

MsgOut is called by legacy code to send outgoing data :

unsigned short UMTrspPort::MsgOut (void *pMsg, unsigned long NbByte,
unsigned long Tag)
{
char *pm = (char *) pMsg;
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
EnterCS (__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after EnterCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

unsigned short retCode = cTrspPort::MsgOut (pMsg, NbByte, Tag);

Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut before LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));
LeaveCS(__FILE__,__LINE__);
Debug::WriteLine
(String::Format ("{0} - UMTrspPort::MsgOut after LeaveCS",
DateTime::get_Now ().ToString ("HH:mm:ss:fff: ")));

return retCode;
}

vMsgOut is called by legacy code when outgoing data is really sent

void UMTrspPort::vMsgOut (unsigned long Tag, unsigned short Err)
{
if (Err != 0)
{
TraceError (String::Format ("UMTrspPort::vMsgOut Tag={0},
Err=
0x{1}", Tag.ToString (), Err.ToString (S"X2")));
}

CommEventData *data = new CommEventData ();

data->EventType = CommEventType::vMsgOut;
data->UlData = Tag;

if (_pCallback)
_pCallback (data);
else
TraceError ("UMTrspPort::vMsgOut no callback defined");
}
Sorry, it is a lot of code but I give you only the minimum.
Thanks for your answer,

Droopy.



Nov 17 '05 #5
I got no answer in mpd.languages.vc !
I thought it was a kind of faq but it doesn't seem.
I can believe I am the only one to get this problem !
Did I ask it wrongly ?

I check for memory leak with a memory profiler.
Did not find memory link in my code but it seems there are memory links
in the String usage made when logging => I disabled tracing and then .... no problem !
So it seems I have to make a refactoring in my logging routines because
I still use "Debug.WriteLine".

Besides, I cannot compile a "Release" version.
In Debug mode, I had a linker error LNK4210 that I solved using the MSDN article #814472.

In Release mode, I have following errors :

with /MD parameter :

3 errors LNK2001 ("__argc", "__argv", "__mbctype")
4 errors LNK2005 ("delete" + "new") for msvcrt.lib (MSVCC71.dll)
1 error LNK2019 __mbctype referenced in function "void __stdcall
_AfxAbbreviateName ..."

with /MT parameter :

2 errors LNK2005 for libcmt.lib (typinfo.obj)
10 errors LNK2005 for msvcrt.lib (MSVCC71.dll)
4 errors LNK2005 for msvcrt.lib (cinitexe.obj)
1 error LNK2019

Thanks in advance for your help.

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: TheKeith | last post by:
I'm writing a script with a while loop in it. How can I get it to go slower so that it doesn't appear to happen all at once--so that it looks animated--basically. I tried the setTimeout(500) in the...
31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
6
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something...
6
by: m | last post by:
Hello, I have an application that processes thousands of files each day. The filenames and various related file information is retrieved, related filenames are associate and placed in a linked...
4
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the...
3
by: Dan Stromberg | last post by:
I have two different python programs that are slowing down quite a bit as their memory use goes up. I'm not really sure if this is some sort of CPU cache effect, or if it's something about...
7
by: davidst95 | last post by:
Hello, I have a program that runs a long process. I tried to add a thread to check if the use hit a cancel button to abort the process. Dim t As Threading.Thread t = New...
10
by: Paul E Collins | last post by:
I want to fill an ImageList with bitmaps for a ListView from another thread, because it's a time-consuming process. I expect the ListViewItems' images to "load" one by one, as in a Web browser. ...
3
by: karl98 | last post by:
Does anyone else experience slowing down of a web conferencing session when 5 or more people join in the meeting? Our web conferences slow down considerably and are driving me nuts.
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.