Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The program isn't debugged until the last user is dead.


devel / comp.lang.xharbour / Memory Leak - xharbour

SubjectAuthor
o Memory Leak - xharbourEduardo Motta

1
Memory Leak - xharbour

<225e145b-3f2f-493b-8d55-eb66c19f8a6cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16805&group=comp.lang.xharbour#16805

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a37:bf82:: with SMTP id p124mr5883711qkf.45.1634232937624;
Thu, 14 Oct 2021 10:35:37 -0700 (PDT)
X-Received: by 2002:a37:a896:: with SMTP id r144mr3198180qke.234.1634232937343;
Thu, 14 Oct 2021 10:35:37 -0700 (PDT)
Path: rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Thu, 14 Oct 2021 10:35:37 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=179.93.80.107; posting-account=ciYPUgkAAACP7h-GihPdeC47vCOdy23j
NNTP-Posting-Host: 179.93.80.107
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <225e145b-3f2f-493b-8d55-eb66c19f8a6cn@googlegroups.com>
Subject: Memory Leak - xharbour
From: eduardo@emotta.com.br (Eduardo Motta)
Injection-Date: Thu, 14 Oct 2021 17:35:37 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 43
 by: Eduardo Motta - Thu, 14 Oct 2021 17:35 UTC

Running the example below the application accumulates memory indefinitely.

Function TestMemoryLeak()
While LastKey() # 27
? InExecution("teste.exe")
HB_GCALL(.t.)
inkey(.01)
EndDo

Return

Static FUNCTION WMIService()
static oWMI

local oLocator

if oWMI == nil
oLocator := CREATEOBJECT( "wbemScripting.SwbemLocator" )
oWMI := oLocator:ConnectServer()
endif

return oWMI

Static Function InExecution(cNameApl)
Local oWmi, oList, oProc
Local cExecName := cNameApl
Local nCont := 0

oWmi := WmiService()

oList := oWmi:ExecQuery( "select * from Win32_Process" )

For each oProc in oList
Try
if cExecName in lower(oProc:ExecutablePath)
nCont++
endif
catch
End
Next

Return nCont

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor