Hi
I would like to know why this c-lines causes extensive memoryleakage
and how I can work around it! The program is actually MUCH larger but
I see that these rows are the ones that cause the leakage. I use the
DAV-function to readout the data-available several times per second.
I am about 99.5% convinced that the SICL-subroutine iopen causes the
memoryleakage (Windows NT task manager reports a memory usage increasing
from about 40 Mb to 130 Mb in a couple of minutes!!!! Finally? - too
much swapping and hints about closing applications).
This is basically how MY program looks like:
int DLL rs232dav(int portnr){
INST comport;
long buffavail;
int status;
switch(portnr){
case 1:
comport=iopen("COM1");
break;
case 2:
comport=iopen("COM2");
break;
default:
return -1;
}
if(comport==0) return -1;
itimeout(comport,5000);
status=iserialstat(comport, I_SERIAL_READ_DAV, &buffavail);
iclose(comport);
return (int)buffavail;
}
// According to the books iopen will create a driver-session. I thought
// that iclose would free that session-memory. I need to close the driver
// after this action cause otherwise other drivers and programs can't
// access it...
Please help me. I really need this kind of interface to RS232!!!
/ Tomas
_/ _/ _/ ERICSSON TELECOM AB mail: Tomas.Tungel@ericsson.com
_/ _/ _/ Attn Tomas Tungel
_/ _/ _/ TN/ETX/PN/XAKD Tel: +46 8 7192658
_/ _/ _/ S-126 25 STOCKHOLM Fax: +46 8 7197503
I would like to know why this c-lines causes extensive memoryleakage
and how I can work around it! The program is actually MUCH larger but
I see that these rows are the ones that cause the leakage. I use the
DAV-function to readout the data-available several times per second.
I am about 99.5% convinced that the SICL-subroutine iopen causes the
memoryleakage (Windows NT task manager reports a memory usage increasing
from about 40 Mb to 130 Mb in a couple of minutes!!!! Finally? - too
much swapping and hints about closing applications).
This is basically how MY program looks like:
int DLL rs232dav(int portnr){
INST comport;
long buffavail;
int status;
switch(portnr){
case 1:
comport=iopen("COM1");
break;
case 2:
comport=iopen("COM2");
break;
default:
return -1;
}
if(comport==0) return -1;
itimeout(comport,5000);
status=iserialstat(comport, I_SERIAL_READ_DAV, &buffavail);
iclose(comport);
return (int)buffavail;
}
// According to the books iopen will create a driver-session. I thought
// that iclose would free that session-memory. I need to close the driver
// after this action cause otherwise other drivers and programs can't
// access it...
Please help me. I really need this kind of interface to RS232!!!
/ Tomas
_/ _/ _/ ERICSSON TELECOM AB mail: Tomas.Tungel@ericsson.com
_/ _/ _/ Attn Tomas Tungel
_/ _/ _/ TN/ETX/PN/XAKD Tel: +46 8 7192658
_/ _/ _/ S-126 25 STOCKHOLM Fax: +46 8 7197503