I'm making a program in VB that will display the netstats of your computer. Every time it updates it stores the information in memory. Which every 5 seconds raises the program memery useage by 24bytes. I no it may seem like not much but when this program is ment to run when you start your computer and run in the background, 24 bytes adds up. So I need to know how to clear the memory of the information I've stored in it. Heres my code that adds the info in the memory.
code:
Public Sub RefreshStack()
Dim i As Long
pDataRef = 0
For i = 0 To nRows '// read 24 bytes at a time
CopyMemory nState, ByVal pTablePtr + (pDataRef + 4), 4
CopyMemory nLocalAddr, ByVal pTablePtr + (pDataRef + 8), 4
CopyMemory nLocalPort, ByVal pTablePtr + (pDataRef + 12), 4
CopyMemory nRemoteAddr, ByVal pTablePtr + (pDataRef + 16), 4
CopyMemory nRemotePort, ByVal pTablePtr + (pDataRef + 20), 4
CopyMemory nProcId, ByVal pTablePtr + (pDataRef + 24), 4
DoEvents
'If nRemoteAddr <> 0 Or nRemotePort <> 0 Or nLocalPort <> 0 Then
Connection(i).State = nState
Connection(i).LocalHost = nLocalAddr
Connection(i).LocalPort = nLocalPort
Connection(i).RemoteHost = nRemoteAddr
Connection(i).RemotePort = nRemotePort
Connection(i).ProcessID = nProcId
Connection(i).ProcessName = GetProcessName(nProcId)
'End If
pDataRef = pDataRef + 24
DoEvents
Next i
End Sub
Now how do I clear or remove the data so I can keep my memory free for other programs to use. And so it don't hog all the memory.
Thanks!