473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Memory Usange In VB.NET

When I run this centence, The memory raise 4Mb in memory:
If Process.GetProcessesByName("ABC,EXE").Length 1 Then

And the routine is end, the memory doesn't drop,
Actually, How Can I free up my memory in a VB.NET application?

GC.collect() seems not so work.

Aug 16 '06 #1
5 3457
My counter question to you is Why ?
As the architecture of a .Net app is to reserve memory

I.O.W.

A .Net Program reserves memory during execution it doesn`t mean that it is
actually using this memory space . advantage of this aproach is a higher
execution speed as memory does not have to be claimed and released on every
memory intensive call .

read this for detailed info :

http://msdn.microsoft.com/library/de...tperftechs.asp
if you really need to free up the memory , thus solving this "cosmetic"
problem

you can do this :

Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" ( _
ByVal process As IntPtr, _
ByVal minimumWorkingSetSize As Integer, _
ByVal maximumWorkingSetSize As Integer) As Integer

GC.Collect()
GC.WaitForPendingFinalizers()
SetProcessWorkingSetSize(Process.GetCurrentProcess ().Handle, -1, -1)
regards

Michel Posseth [MCP]


"Cylix" wrote:
When I run this centence, The memory raise 4Mb in memory:
If Process.GetProcessesByName("ABC,EXE").Length 1 Then

And the routine is end, the memory doesn't drop,
Actually, How Can I free up my memory in a VB.NET application?

GC.collect() seems not so work.

Aug 16 '06 #2
But I just use that line once and never use it any more.
So I don't want it to keep any cache ...

Aug 17 '06 #3
No it isn`t about caching values

The framework determines the potential memory usage of your program and
reserves the memory ,

If you don`t use it fine ,,, but if you might use it this would speed op the
overall perfomance of your application .
if the system is running low on memory the GC could kick in and give the
memory back to the system ,,, however with modern computers this is not
lickely to happen so often .

as i said i once had a customer who demanded a low mem usage in the
taskmanager so i used the trick i showed in my previous post ,,, however this
is more cosmetic as a reall usage strategy as it hurts the performance of
your application .
regards

Michel Posseth [MCP]
"Cylix" wrote:
But I just use that line once and never use it any more.
So I don't want it to keep any cache ...

Aug 17 '06 #4
Dear Michel,

I would like to know more about this.
I have already tried your code and it really make the memory shown on
task manager.
May I know what memory is release under your code?

And how it hunrt the application performance?

Actually, In my office, most of computer is P4 2GHz with 512MB Ram,
but some of old machines are just P3 800MHz, 256MB Ram,
They need to open a number of MS Word and MS OUTLOOK Items.

So, The memory is really limited.

Aug 17 '06 #5


It's working... but it only increase Memory, Virtual Memory is still
growing..:(

*** Sent via Developersdex http://www.developersdex.com ***
Oct 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
4
by: Frank Esser | last post by:
I am using SQL 8 Personal edition with sp2 applied. I set the max server memory to 32MB and leave the min server memory at 0. When my application starts hitting the database hard the memory usage...
0
by: Bill Burwell | last post by:
Which memory properties, or what combinations of memory properties, provide useful information about a program's memory usage when that program has just started leaking memory? While I have...
9
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but...
22
by: xixi | last post by:
hi, we are using db2 udb v8.1 for windows, i have changed the buffer pool size to accommadate better performance, say size 200000, if i have multiple connection to the same database from...
14
by: Alessandro Monopoli | last post by:
Hi all, I'm searching a PORTABLE way to get the available and total physical memory. Something like "getTotalMemory" and it returns the memory installed on my PC in bytes, and...
5
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS...
1
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after...
5
by: cham | last post by:
Hi, I am working on c++ in a linux system ( Fedora core 4 ), kernel version - 2.6.11-1.1369_FC4 gcc version - 4.0.0 20050519 ( Red Hat 4.0.0-8 ) In my code i am creating a vector to store...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.