Menory compaction

  • Thread starter Thread starter Adrian
  • Start date Start date
A

Adrian

Hi
From within a VB app how do you cause a global memory compaction or free
up as per the many memory freeing applications?

Can you say via VB to windows to clean-up/ free up memory used by just one
application?

I have been looking for an example but thus far can't find one!


Thanks
 
Hi Adrian,

If you are referring to VB.NET (and not VB6), the memory is automatically
managed and you don´t have to worry about that, the operating system signals
applications when the system is low on memory and .NET applications free
memory. You can force it on your .NET application calling
System.GC.Collect().

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
 
Thanks the app is dotnet But the memory clean up is not for this app its for
an older app! I was hoping to write a simple clean up app that would cause
either a garbage collection for the one app or system wide which I would
trigger from my VB.Net app.

System.GC.Collect() is this system wide or just for dotnet apps?

Thanks
 
ok done this:

Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd
As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long)
As Long

Sub Main()
Dim myresult As Long
myresult = PostMessage(-1, 65, 0, 0)
MsgBox(myresult.ToString)
End Sub

but it still does not free the memory used by the old app applications such
as MEMORyAL 4.2.1
do, how do they do it?
 
Adrian said:
ok done this:

Declare Function PostMessage Lib "user32" Alias "PostMessageA"
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer,
ByVal lParam As Long) As Long


This declaration is for VB6.


VB.Net declaration:

Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean


I only corrected the declaration. I don't know if this solves the problem.

(see also System.Windows.Forms.Message)


Armin
 
Back
Top