how to release memory resources in vb.net 2005

M

mina

hi
i am using vb.net 2005 to my desktop application.
my problem is like this
when i am running my project it occupies 100% cpu at 1st form load.
then again it release memory upto 95%.
when i am calling new / loading another form it agein occuipes 100%
cpu or near about it.
While loading each form i am doing like this:
me.close
me.dispose
system.gc.collect()
but it can not release memory resources doing


also while opening data base connection i am doing like this
connection.dispose
command.dispose
reader.dispose
dataset.dispose

but it still shows me cpu ocuuipes near about 70 % to 90 %

can any one help me.....
 
K

kimiraikkonen

hi
i am using vb.net 2005 to my desktop application.
my problem is like this
when i am running my project it occupies 100% cpu at 1st form load.
then again it release memory upto 95%.
when i am calling new / loading another form it agein occuipes 100%
cpu or near about it.
While loading each form i am doing like this:
me.close
me.dispose
system.gc.collect()
but it can not release memory resources doing

also while opening data base connection i am doing like this
connection.dispose
command.dispose
reader.dispose
dataset.dispose

but it still shows me cpu ocuuipes near about 70 % to 90 %

can any one help me.....

Mina,
Even you close / dispose all the underlying resources properly, CPU
usage may depend on the content of your form. For example if you have
a heavy Flash movie in your form, your form has nothing to do with
CPU, most of CPU cost is done by flash / ActiveX control etc. Shortly,
analyzing your form content and code would give more idea.
 
M

mina

Mina,
Even you close / dispose all the underlyingresourcesproperly, CPU
usage may depend on the content of your form. For example if you have
a heavy Flash movie in your form, your form has nothing to do with
CPU, most of CPU cost is done by flash / ActiveX control etc. Shortly,
analyzing your form content and code would give more idea.- Hide quoted text -

- Show quoted text -

Thanks for reply ,
In my whole project i am not using any type of flash control
it purely vb.net 2005 application. Here i am using reporting tool as
crystal report which in build in 2005.
and for database MS-Access.
each form has its own functionality but some form can called from
another form.
In short whenerver i am callin new form inside the current form that
time my cpu time goes to high pick....


if some body can help me.........
then i really say thanks...
 
B

Bill McCarthy

Do *not* call GC.Collect. That will cause greater processor load.

Also use logging and perf counters to try to identify where the main
problems lay.
 
K

kimiraikkonen

Do *not* call GC.Collect. That will cause greater processor load.

Also use logging and perf counters to try to identify where the main
problems lay.

Bill,
I also compared that using GC.Collect in a picturebox's mouseMove
event caused %100 CPU usage while drawing a rectangle on the
picturebox (having a 6 megapixel picture) as well as unusing
GC.Collect also caused %100 CPU usage with no major difference in
excessive CPU usage on my 2.4GHZ Intel P4 processor.

As i stated in the past, I still wonder why picturebox control costs
huge CPU especially while moving them in a form around the screen or
drawing sth like rectangle on picturebox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top