BUG: Memory Leak Using UBound or LBound When Returning Array
Article ID: 197190
Article Last Modified on 5/13/2003
APPLIES TO
- Microsoft Visual Basic 6.0 Learning Edition
- Microsoft Visual Basic 6.0 Professional Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
This article was previously published under Q197190
SYMPTOMS
When you use a function that returns an array as a parameter to the UBound
or LBound functions, the memory allocated for the array is not released.
CAUSE
The array is copied to temporary return storage, but the temporary storage
is not released until the application ends.
RESOLUTION
To avoid this problem, assign the return value to a local variable before
using UBound or LBound. For example:
vntReturn = ArryFunc()
iAryLen = UBound(vntReturn)
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
Keywords: kbbug kbpending KB197190