11-10-2021 08:14 AM
Hello,
I open an ftp handle with
l_ftpHandle = InetFTPLogin("192.168.192.170","super","user");
and close it with
InetFTPClose (l_ftpHandle);
Everything works, but the curious thing is that as this runs repeatedly, each time the l_ftpHandle increments by one when created again, even though it was supposedly disposed of.
Am I missing something?
The inet resource goes away in the resource windows, just wanting to be sure I'm not creating a handle leak.
Thanks
Terry Moss
11-11-2021 05:36 PM
Most likely not. The handle is each time a new value to avoid use after free errors. It is not an index in some array but rather an identifier that serves as lookup value in a sorted list. If they got fancy it may even use a sorted red-black tree as lookup mechanism, which is incredibly fast even if you have a lot of elements in the tree.
By using a new monotonic increasing identifier each time, you can't run into the problem that some code tries to use a handle after it has been freed.