Even in this simple example, the program's opened handles keep increasing.
This will be a problem in programs that run for long time.
This is my enviroment and example source.
OS: Windows 11 25H2
Device: PCAN-USB
Driver: 5.0.0.2
PCAN Basic API: 5.0.0.1115
Code: Select all
int main()
{
while (1)
{
TPCANStatus status = CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_500K, 0, 0, 0);
if (status != PCAN_ERROR_OK)
{
printf("Error on CAN_Initialize: 0x%X", status);
exit(1);
}
status = CAN_Uninitialize(PCAN_USBBUS1);
if (status != PCAN_ERROR_OK)
{
printf("Error on CAN_Uninitialize: 0x%X", status);
exit(2);
}
// According to manual, need about 500ms to uninitialize TX queue
Sleep(1000);
}
return (0);
}Code: Select all
246 Handles
Type Count
None 7
Event 17
Section 1
File 7
Directory 2
Mutant 3
Semaphore 2
Key 9
Token 180
Thread 2
IoCompletion 3
TpWorkerFactory 3
ALPC Port 2
WaitCompletionPacket 8Regards,
