New topic: 

REALSQLDatabase - SQLSelect still has memory leak?

<http://forums.realsoftware.com/viewtopic.php?t=36567>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        norbo          Post subject: REALSQLDatabase - SQLSelect still 
has memory leak?Posted: Wed Dec 08, 2010 3:01 pm                         
Joined: Tue Dec 07, 2010 1:56 pm
Posts: 4                [note: I posted this yesterday under a generic memory 
leak thread, but should have started a new topic since it's now narrowed down 
to SQLSelect - so I'm doing that here - sorry for the duplication] 

It looks like there still is an SQLSelect related memory leak in 2010r41.  
(running in windows xp)

The release notes for 2010r1 claim that
FIX  10948  Fixed a memory leak in the SQLSelect method.

It appears that each call we make to SQLSelect leaks about 60 bytes of memory 
in 2010r3 and 21010r4. There is no leak in 2009r1 or 2009r3. This 60 bytes is a 
big deal for this particular code because it gets called many times. I've 
managed to re-create the leak in the short snippet of code below.

Our production code uses a RAM database. In operation one section of the code 
inserts data into the table and another thread polls the table to see if there 
is any new data that needs processing.

The test code below just simulates the piece of code that polls the database to 
see if there are new records to process. The real code checks once per second 
and doesn't block.

Can someone confirm that memory use goes up when the following simple code is 
run? Did I miss something stupid?

Code:  dim m_dbDataCache as REALSQLDatabase
  
  //New Database
  m_dbDataCache = new REALSQLDatabase
  if(false = m_dbDataCache.Connect()) then
  //Failed to initialize?
  return
  else
  //Insert the schema
  m_dbDataCache.SQLExecute("create table DataCache(DataID INTEGER PRIMARY KEY, 
Col_1 Integer, Col_2 Integer, Col_3 Integer)")
  if(true = m_dbDataCache.Error) then
  //Failed to build?
  return
  end if
  end if
  
  dim rsReturn As RecordSet
  dim loopCount as integer = 1
  dim ii as integer
  
  // loop to test leak (watch priv memory in task manager or process explorer)
  do until loopCount > 10000
  
  // check to see if any data is in database (this causes the leak? about 60 
bytes per call)
  rsReturn = m_dbDataCache.SQLSelect("select DataID from DataCache")
  
  // normally we'd check rsReturn for eof or nil or 0 records here
  // - but it doesn't make a difference in this example, so just set to nil
  rsReturn = nil
  
  // slow it down enough to see the priv memory go up without overdoing it
  ii = Ticks
  do 
  if Ticks > (ii+1) then
   exit
  end if
  loop
  
  loopCount = loopCount + 1
  
  loop


So far I've tried the following versions:
2009r1 - no leak
2009r3 - no leak
2010r1 - leak
2010r3 - leak
2010r4.1 - leak   
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to