Microsoft KB Archive/107405: Difference between revisions

From BetaArchive Wiki
m (Text replacement - """ to """)
m (Text replacement - "&" to "&")
 
(2 intermediate revisions by the same user not shown)
Line 37: Line 37:


   // LCK 'C' Code test.c
   // LCK 'C' Code test.c
   #include <pro_ext.h>
   #include <pro_ext.h>
   void FAR Generic(ParamBlk FAR *parm)
   void FAR Generic(ParamBlk FAR *parm)
   {
   {
Line 51: Line 51:
   // structure
   // structure


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


   // Replace character field with information from passed in variable
   // Replace character field with information from passed in variable


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


   }
   }

Latest revision as of 12:24, 21 July 2020

BUG: _DBReplace() in LCK Leaks Memory

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


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