Groups
Sign in
Groups
comp.lang.xharbour
Conversations
About
Send feedback
Help
info
Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss
Learn more
Memory Leak - xharbour
79 views
Skip to first unread message
Eduardo Motta
unread,
Oct 14, 2021, 1:35:38 PM
10/14/21
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
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
0 new messages