Dim x As Int16, keypos As Int16, t As Long, j As Int16
Dim KeyWordLen As Long = Len(KeyWord)
Dim rc4Next_Rand As Int16
Dim RC4S(255) As Int16
Dim RC4K(255) As Int16
Dim RC4I As Int16, RC4J As Int16, RC4T As Int16
Each time the function was called the memory consumed by the application increased significantly. The user observed the memory increase using the Task Panel, which shows the number of bytes a program is currently consuming. It was obvious that the memory allocated using the array declaration wasn't released. This is strange because it is explicitly stated that local arrays are cleared automatically. However, in this particular case the memory didn't get freed.
Testing other subroutines revealed that the compiler DOES generate code to clear local arrays, except when the routine doesn't contain a local string variable. Would the developer have declared a local string variable and had he put the characters in that string variable he would never have noticed the problem. Now he used the local variable that was passed as an argument. Adding a declaration of some string variable would have caused the compiler to insert clearing code:
Val (or ValDbl which is identical) is the workhorse for string to the floating-point conversions. When the number of digits after the dot are more than 13 the Val() function returns wrong values.
Note: this bug has been solved in the build 1165 update.