Outline ·
[ Standard ] ·
Linear+
[WTA] VB.Net - Memory comsuming, how to minimized memory used
|
TSnaim_mahmood
|
Feb 25 2006, 11:15 PM, updated 20y ago
|
Getting Started

|
Hi guys.
i'm currently doing a simple clock program nothing much like the one from microsoft "DATE & TIME PROPERTIES"
i just add text clock + calendar, the question is why the program consume memory too much 17MB ! microsoft date & time properties only about 3 ~ 4 mb.
pls give some thought,
thanks.
|
|
|
|
|
|
nameless
|
Feb 26 2006, 12:06 AM
|
|
VB.Net application required NET Framework runtime to run , just like JAVA with Java runtime which is hungry for memory & CPU usage.
I Guess, that normal for WIN32 .Net Application
Try Imagine , Last time I have been demo complex VB.net app on a client's PC which only has 64MB. T_T
|
|
|
|
|
|
anthony_yio
|
Feb 27 2006, 11:24 AM
|
........
|
QUOTE(naim_mahmood @ Feb 25 2006, 11:15 PM) Hi guys. i'm currently doing a simple clock program nothing much like the one from microsoft "DATE & TIME PROPERTIES" i just add text clock + calendar, the question is why the program consume memory too much 17MB ! microsoft date & time properties only about 3 ~ 4 mb. pls give some thought, thanks. So, now you guys realize the no need to worry about resource leak do come with price? Anyway, to improve the situation slightly. You can try http://msdn.microsoft.com/library/default....enetchapt05.asp
|
|
|
|
|
|
dstl1128
|
Feb 27 2006, 05:27 PM
|
|
No matter how you trim it, you basically need a nominal usage of around 10~15MB for that (minimumal) framework run-time, and few MB for your app.
|
|
|
|
|
|
sinx
|
Feb 28 2006, 09:11 AM
|
New Member
|
Here come with my dirty trick! Try to call FlushMemory() in every XX seconds then you can see the effect. Remember, this is DIRTY way. It might NOT REALLY reduce memory usage but i think no harm to try. CODE Public Class MemoryManagement
Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" ( _ ByVal process As IntPtr, _ ByVal minimumWorkingSetSize As Integer, _ ByVal maximumWorkingSetSize As Integer) As Integer
Public Shared Sub FlushMemory()
GC.Collect() GC.WaitForPendingFinalizers()
If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1) End If
End Sub End Class
|
|
|
|
|