BUG: _DBReplace() in LCK Leaks Memory

Last reviewed: September 26, 1995
Article ID: Q107405
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for MS-DOS, versions 2.6x

SYMPTOMS

In the FoxPro Library Construction Kit, if you use the _DBReplace() function to replace information into a character field in a database, memory will slowly be lost.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Problem

The following code can be used to reproduce the problem. The SYS(1016) value will change approximately every 200-400 calls to the library. It will change by values around 2 kilobytes each time. There is currently no known workaround.

   * FoxPro Code
   CLOSE ALL
   CLEAR ALL
   x = "a"
   CREATE TABLE lcktest (tstfield c(25))
   APPEND BLANK
   SET LIBRARY TO test.dll
   FOR i=1 TO 10000
     ?SYS(1016),i
     =myplbfunc(REPLICATE( X ,10))
   ENDFOR

   // LCK 'C' Code test.c
   #include <pro_ext.h>
   void FAR Generic(ParamBlk FAR *parm)
   {
   Value myval;
   Locator DbfFldLoc;

   // Locate field named 'tstfield'

   if ((DbfFldLoc.l_NTI = _NameTableIndex("tstfield")) == -1)
      _UserError("Failed at _NameTableIndex call.");

   // Find the field in the database, and store location to Locator
   // structure

   if (_FindVar(DbfFldLoc.l_NTI, 1, &DbfFldLoc) == 0)
      _UserError("Failed at _FindVar call.");

   // Replace character field with information from passed in variable

   _DBReplace(&DbfFldLoc,&parm->p[0].val);

   }

   FoxInfo myFoxInfo[] = {
        {"MYPLBFUNC", (FPFI) Generic, 1, "C"},
   };

   FoxTable _FoxTable = {
        (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
   };


Additional reference words: FoxWin FoxDos 2.50 2.50a 2.50b 2.60 2.60a
buglist2.50 buglist2.50a buglist2.50b buglist2.60 buglist2.60a LCK API
KBCategory: kbtool kbenv kbbuglist
KBSubcategory: FxtoolLck


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 26, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.