Microsoft KB Archive/299322

= FIX: &quot;Too Many Names Used&quot; Error with Repeated AddObject/RemoveObject Calls =

Article ID: 299322

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q299322



SYMPTOMS
When a program makes repeated calls to the AddObject and RemoveObject methods, the following error message may be received:

Too Many Names Used



CAUSE
Visual FoxPro is not releasing unused names from the internal names table used to keep track of created objects.



STATUS
This problem was corrected in Microsoft Visual FoxPro version 7.0 for Windows.



Steps to Reproduce Behavior
  Paste the following code in a new program: ON KEY LABEL F5 DO CleanUp CLEAR ALL CLEAR

LOCAL lcVarName, lni, loCont PUBLIC glKeepGoing loCont = CREATEOBJECT(&quot;Container&quot;) glKeepGoing = .T. lni = 0

DO WHILE glKeepGoing lni = lni+1 lcVarName = &quot;ln&quot; + SYS(2015) loCont.ADDOBJECT(lcVarName ,&quot;Line&quot;) loCont.REMOVEOBJECT(lcVarName) IF MOD(lni,500) = 0 ? lni, SYS(1011), SYS(1016) _CALCMEM = lni && The Calculator Memory will persist && through the following CLEAR ALL. CLEAR ALL LOCAL loCont, lni, lcVarName glKeepGoing = .T.       loCont = CREATEOBJECT(&quot;Container&quot;) lni = INT(_CALCMEM) ENDIF ENDDO

PROCEDURE CleanUp glKeepGoing = .F.   ON KEY LABEL F5 ENDPROC  Save and then run the code (the program name is not important).

You can press F5 at any time to end the running program. The numbers printed to the screen are loop iterations. They show the value of SYS(1011) (Number of Memory Handles) and the value of SYS(1016) (User Object Memory Use). The error occurs when the number of iterations reaches around 64000.

(c) Microsoft Corporation 2001, All Rights Reserved. Contributions by Trevor Hancock, Microsoft Corporation.

Keywords: kbbug kbfix kboop kbvfp700fix KB299322

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.