469,917 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Menory compaction

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
Feb 28 '06 #1
6 1487
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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
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

Feb 28 '06 #2
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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
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


Feb 28 '06 #3
System.GC.Collect only affects to your own .NET app.

For your purpose, see the WM_COMPACTING Win32 message:

http://msdn.microsoft.com/library/de...compacting.asp
--

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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
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



Feb 28 '06 #4
Thanks Carlos
How do you send such messages fom VB.net?
"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in message
news:ej**************@TK2MSFTNGP14.phx.gbl...
System.GC.Collect only affects to your own .NET app.

For your purpose, see the WM_COMPACTING Win32 message:

http://msdn.microsoft.com/library/de...compacting.asp
--

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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
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



Feb 28 '06 #5
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" <Ad****@nospamhotmail.com.uk> wrote in message
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Thanks Carlos
How do you send such messages fom VB.net?
"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in
message news:ej**************@TK2MSFTNGP14.phx.gbl...
System.GC.Collect only affects to your own .NET app.

For your purpose, see the WM_COMPACTING Win32 message:

http://msdn.microsoft.com/library/de...compacting.asp
--

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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.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

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAMsogecable.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
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
"Adrian" <Ad****@nospamhotmail.com.uk> escribió en el mensaje
news:du**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
> 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
>



Feb 28 '06 #6
"Adrian" <Ad****@nospamhotmail.com.uk> schrieb
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
Mar 3 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Michael D. Ober | last post: by
62 posts views Thread by Born | last post: by
350 posts views Thread by Lloyd Bonafide | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.