There will be no memory leak. The variable pff which references the instance will be lost outside the function. By creating a new coo instance you are effectively adding this to a global type list, regardless of whether it's inside or outside the function.
So, in your example you are actually creating 2 x instances, one outside the function and one inside. This is the correct way to do it ...
So, in your example you are actually creating 2 x instances, one outside the function and one inside. This is the correct way to do it ...
Type coo Field a Field b End Type test.coo = jack(1,2) Print test\a Print test\b WaitKey() End