473,387 Members | 1,574 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.

WebBrowser control - High memory use

Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.

Jun 27 '08 #1
17 7919

And the problem with that is?

Cor
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.
Jun 27 '08 #2
On May 14, 7:45 am, "Cesar" <cesardemi @ yahoo . com . arwrote:
Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.
Cesar,
I've noticed that Webbrowser uses high amount of memory if webbrowser
has a heavy flash content. Please try to navigate some sites which
doesn't contain any flash content, then compare the results.

Thanks,

Onur Güzel
Jun 27 '08 #3

The webbrowser control is a memory hungry control , i have ponce tryed the
Mozilla control instead but at that time it was indeed less demanding on
memory but it was verry unstable i do not know how this is now at this time
..

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects
A workaround could be to set the process working setsize of your project
once in a while ,than you get the same behaviour as minimizing and
maximizing the application by hand ( try it out and watch the memory usage )

as long as the application domain is loaded the memory will be reserved
for further processing
if your comp would run low on resources and the app does not need the memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )
with a windows form application you can see this behavior to ( or did you
really thought a clean form needs about +- 25 megs in .Net ? )
there is a way you can bypass this behavior however it comes with a small
price ,,,,
i wrote once a remoting project , and had my customer complaining about the
memory consumption , so i digged a litle bit deeper and came with this
solution
my project ( wich is a singleton ) starts a timer that periodicly checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry VB.Net
-) )
Private M_dtLastUsage As DateTime
Private oCallback As New TimerCallback(AddressOf OnTick)
Private oTimer As Threading.Timer
Public Sub OnTick(ByVal stateInfo As Object)
Dim DtCurrent As DateTime = Date.Now
Dim elapsed_time As TimeSpan
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
If elapsed_time.TotalMinutes >= 1 Then
oTimer.Dispose() : oTimer = Nothing
SetProcessWorkingSetSize()
End If
End Sub
Public Sub New()
M_dtLastUsage = Date.Now
If IsNothing(oTimer) Then
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
End If
End Sub
Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean
Friend Sub SetProcessWorkingSetSize()
Try
Dim Mem As Process = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower as it
could be.
So it is more cosmetical as that it does really have a purpose as the prog
is actually gone to the swap same as a minimized application ( physical and
virtual memory thingy )

HTH

Michel Posseth
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.

Jun 27 '08 #4
On May 14, 8:29*pm, "Michel Posseth [MCP]" <M...@posseth.comwrote:
The webbrowser control is a memory hungry control , i have ponce tryed the
Mozilla control instead but at that time it was indeed less demanding on
memory but it was verry unstable *i do not know how this is now at this time
.

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects

A workaround could be to set the process working setsize of your project
once in a while ,than you get the same behaviour as minimizing and
maximizing the application by hand ( try it out and watch the memory usage)

as long as the application domain is loaded the memory will be reserved
for further processing

if your comp would run low on resources and the app does not need the memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )

with a windows form application you can see this behavior to ( or did you
really thought a clean form needs about +- 25 megs in .Net ? )

there is a way you can bypass this behavior however it comes with a small
price ,,,,
i wrote once a remoting project , and had my customer complaining about the
memory consumption , so i digged a litle bit deeper and came with this
solution

my project ( wich is a singleton ) starts a timer that periodicly checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry VB.Net
-) )

Private M_dtLastUsage As DateTime

Private oCallback As New TimerCallback(AddressOf OnTick)

Private oTimer As Threading.Timer

Public Sub OnTick(ByVal stateInfo As Object)

Dim DtCurrent As DateTime = Date.Now

Dim elapsed_time As TimeSpan

elapsed_time = DtCurrent.Subtract(M_dtLastUsage)

If elapsed_time.TotalMinutes >= 1 Then

oTimer.Dispose() : oTimer = Nothing

SetProcessWorkingSetSize()

End If

End Sub

Public Sub New()

M_dtLastUsage = Date.Now

If IsNothing(oTimer) Then

oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))

End If

End Sub

Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean

Friend Sub SetProcessWorkingSetSize()

Try

Dim Mem As Process = Process.GetCurrentProcess()

SetProcessWorkingSetSize(Mem.Handle, -1, -1)

Catch ex As Exception

End Try

End Sub

The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower as it
could be.

So it is more cosmetical as that it does really have a purpose as the prog
is actually gone to the swap same as a minimized application *( physicaland
virtual memory thingy )

HTH

Michel Posseth

"Cesar" <cesardemi @ yahoo . com . arschreef in berichtnews:eQ**************@TK2MSFTNGP03.phx.gbl. ..
Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...
Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...
Thanks in advance.
Regards.
Cesar.- Hide quoted text -

- Show quoted text -
Michel,
I've also noticed that even i cannot navigate to a simple site using
Mozilla control, which crashes on navigation everytime.
http://groups.google.com/group/micro...2f9f1188ebdd2c

.NET's Webbrowser is better in this case(but it's IE-based which means
a bit slow and crash-tended), but i wish there was a Mozilla control
(Gecko engine of course) that works like current Mozilla browser's
current release at least.

Thanks,

Onur
Jun 27 '08 #5
Michael,

Is this not the syntatical solution to let the taskmanager show the actual
in used memory.

That was why I asked what was the problem instead of every time, how do you
know that the memory consumption is high, the taskmanager is not meant as a
development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl...
>
The webbrowser control is a memory hungry control , i have ponce tryed the
Mozilla control instead but at that time it was indeed less demanding on
memory but it was verry unstable i do not know how this is now at this
time .

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects
A workaround could be to set the process working setsize of your project
once in a while ,than you get the same behaviour as minimizing and
maximizing the application by hand ( try it out and watch the memory
usage )

as long as the application domain is loaded the memory will be reserved
for further processing
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )
with a windows form application you can see this behavior to ( or did you
really thought a clean form needs about +- 25 megs in .Net ? )
there is a way you can bypass this behavior however it comes with a small
price ,,,,
i wrote once a remoting project , and had my customer complaining about
the
memory consumption , so i digged a litle bit deeper and came with this
solution
my project ( wich is a singleton ) starts a timer that periodicly checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry VB.Net
-) )
Private M_dtLastUsage As DateTime
Private oCallback As New TimerCallback(AddressOf OnTick)
Private oTimer As Threading.Timer
Public Sub OnTick(ByVal stateInfo As Object)
Dim DtCurrent As DateTime = Date.Now
Dim elapsed_time As TimeSpan
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
If elapsed_time.TotalMinutes >= 1 Then
oTimer.Dispose() : oTimer = Nothing
SetProcessWorkingSetSize()
End If
End Sub
Public Sub New()
M_dtLastUsage = Date.Now
If IsNothing(oTimer) Then
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
End If
End Sub
Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean
Friend Sub SetProcessWorkingSetSize()
Try
Dim Mem As Process = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower as
it
could be.
So it is more cosmetical as that it does really have a purpose as the prog
is actually gone to the swap same as a minimized application ( physical
and
virtual memory thingy )

HTH

Michel Posseth
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
>Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.

Jun 27 '08 #6
synthetic

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:0D**********************************@microsof t.com...
Michael,

Is this not the syntatical solution to let the taskmanager show the actual
in used memory.

That was why I asked what was the problem instead of every time, how do
you know that the memory consumption is high, the taskmanager is not meant
as a development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl...
>>
The webbrowser control is a memory hungry control , i have ponce tryed
the Mozilla control instead but at that time it was indeed less demanding
on memory but it was verry unstable i do not know how this is now at
this time .

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects
A workaround could be to set the process working setsize of your project
once in a while ,than you get the same behaviour as minimizing and
maximizing the application by hand ( try it out and watch the memory
usage )

as long as the application domain is loaded the memory will be reserved
for further processing
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )
with a windows form application you can see this behavior to ( or did you
really thought a clean form needs about +- 25 megs in .Net ? )
there is a way you can bypass this behavior however it comes with a small
price ,,,,
i wrote once a remoting project , and had my customer complaining about
the
memory consumption , so i digged a litle bit deeper and came with this
solution
my project ( wich is a singleton ) starts a timer that periodicly checks
a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry VB.Net
-) )
Private M_dtLastUsage As DateTime
Private oCallback As New TimerCallback(AddressOf OnTick)
Private oTimer As Threading.Timer
Public Sub OnTick(ByVal stateInfo As Object)
Dim DtCurrent As DateTime = Date.Now
Dim elapsed_time As TimeSpan
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
If elapsed_time.TotalMinutes >= 1 Then
oTimer.Dispose() : oTimer = Nothing
SetProcessWorkingSetSize()
End If
End Sub
Public Sub New()
M_dtLastUsage = Date.Now
If IsNothing(oTimer) Then
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
End If
End Sub
Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean
Friend Sub SetProcessWorkingSetSize()
Try
Dim Mem As Process = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower as
it
could be.
So it is more cosmetical as that it does really have a purpose as the
prog
is actually gone to the swap same as a minimized application ( physical
and
virtual memory thingy )

HTH

Michel Posseth
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
>>Hello people. I'm having a Winform app that contains a webbrowser
control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.


Jun 27 '08 #7
Cor Ligthert [MVP] schreef:
synthetic

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:0D**********************************@microsof t.com...
>Michael,

Is this not the syntatical solution to let the taskmanager show the actual
in used memory.

That was why I asked what was the problem instead of every time, how do
you know that the memory consumption is high, the taskmanager is not meant
as a development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl...
>>The webbrowser control is a memory hungry control , i have ponce tryed
the Mozilla control instead but at that time it was indeed less demanding
on memory but it was verry unstable i do not know how this is now at
this time .

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects
A workaround could be to set the process working setsize of your project
once in a while ,than you get the same behaviour as minimizing and
maximizing the application by hand ( try it out and watch the memory
usage )

as long as the application domain is loaded the memory will be reserved
for further processing
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )
with a windows form application you can see this behavior to ( or did you
really thought a clean form needs about +- 25 megs in .Net ? )
there is a way you can bypass this behavior however it comes with a small
price ,,,,
i wrote once a remoting project , and had my customer complaining about
the
memory consumption , so i digged a litle bit deeper and came with this
solution
my project ( wich is a singleton ) starts a timer that periodicly checks
a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry VB.Net
-) )
Private M_dtLastUsage As DateTime
Private oCallback As New TimerCallback(AddressOf OnTick)
Private oTimer As Threading.Timer
Public Sub OnTick(ByVal stateInfo As Object)
Dim DtCurrent As DateTime = Date.Now
Dim elapsed_time As TimeSpan
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
If elapsed_time.TotalMinutes >= 1 Then
oTimer.Dispose() : oTimer = Nothing
SetProcessWorkingSetSize()
End If
End Sub
Public Sub New()
M_dtLastUsage = Date.Now
If IsNothing(oTimer) Then
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
End If
End Sub
Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean
Friend Sub SetProcessWorkingSetSize()
Try
Dim Mem As Process = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower as
it
could be.
So it is more cosmetical as that it does really have a purpose as the
prog
is actually gone to the swap same as a minimized application ( physical
and
virtual memory thingy )

HTH

Michel Posseth
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello people. I'm having a Winform app that contains a webbrowser
control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.




Synthetic ??? wel if you read my message you see that i call it myself
Cosmetic :-) , i also point out why

HTH
Michel
Jun 27 '08 #8
Michel,

You did, and I saw it, however I thought that you was meaning that there was
really some memory cleaned. AFAIK , is the cosmetic part only takskmanager.

:-)

Cor

"Michel Posseth" <ms****@posseth.comschreef in bericht
news:uU**************@TK2MSFTNGP03.phx.gbl...
Cor Ligthert [MVP] schreef:
>synthetic

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:0D**********************************@microso ft.com...
>>Michael,

Is this not the syntatical solution to let the taskmanager show the
actual in used memory.

That was why I asked what was the problem instead of every time, how do
you know that the memory consumption is high, the taskmanager is not
meant as a development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl.. .
The webbrowser control is a memory hungry control , i have ponce tryed
the Mozilla control instead but at that time it was indeed less
demanding on memory but it was verry unstable i do not know how this
is now at this time .

I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is for
these projects
A workaround could be to set the process working setsize of your
project once in a while ,than you get the same behaviour as minimizing
and maximizing the application by hand ( try it out and watch the
memory usage )

as long as the application domain is loaded the memory will be reserved
for further processing
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back and
needs to be reclaimed )
with a windows form application you can see this behavior to ( or did
you
really thought a clean form needs about +- 25 megs in .Net ? )
there is a way you can bypass this behavior however it comes with a
small
price ,,,,
i wrote once a remoting project , and had my customer complaining about
the
memory consumption , so i digged a litle bit deeper and came with this
solution
my project ( wich is a singleton ) starts a timer that periodicly
checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call
SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry
VB.Net
-) )
Private M_dtLastUsage As DateTime
Private oCallback As New TimerCallback(AddressOf OnTick)
Private oTimer As Threading.Timer
Public Sub OnTick(ByVal stateInfo As Object)
Dim DtCurrent As DateTime = Date.Now
Dim elapsed_time As TimeSpan
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
If elapsed_time.TotalMinutes >= 1 Then
oTimer.Dispose() : oTimer = Nothing
SetProcessWorkingSetSize()
End If
End Sub
Public Sub New()
M_dtLastUsage = Date.Now
If IsNothing(oTimer) Then
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
End If
End Sub
Private Declare Auto Function SetProcessWorkingSetSize Lib
"kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As
Boolean
Friend Sub SetProcessWorkingSetSize()
Try
Dim Mem As Process = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower
as it
could be.
So it is more cosmetical as that it does really have a purpose as the
prog
is actually gone to the swap same as a minimized application (
physical and
virtual memory thingy )

HTH

Michel Posseth
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello people. I'm having a Winform app that contains a webbrowser
control
that keeps navigating from one page to another permanentrly to make
some
tests. The problem I'm having is that after a while, the application
is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for
a
long period of time, but I've seen no answers at all about it...
>
Does anyone here has an answer for this control's behaviour?? I've
tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...
>
Thanks in advance.
>
Regards.
>
Cesar.
>
>
>


Synthetic ??? wel if you read my message you see that i call it myself
Cosmetic :-) , i also point out why

HTH
Michel
Jun 27 '08 #9
Taskmanager shouldn`t be used to check for "reall" memory consumption of
..Net apps , however sorry for us the end user doesn`t know this and starts
complaining that is why i introduced the previous trick in some of my apps .


Michel

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:33**********************************@microsof t.com...
Michel,

You did, and I saw it, however I thought that you was meaning that there
was really some memory cleaned. AFAIK , is the cosmetic part only
takskmanager.

:-)

Cor

"Michel Posseth" <ms****@posseth.comschreef in bericht
news:uU**************@TK2MSFTNGP03.phx.gbl...
>Cor Ligthert [MVP] schreef:
>>synthetic

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:0D**********************************@micros oft.com...
Michael,

Is this not the syntatical solution to let the taskmanager show the
actual in used memory.

That was why I asked what was the problem instead of every time, how do
you know that the memory consumption is high, the taskmanager is not
meant as a development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl. ..
The webbrowser control is a memory hungry control , i have ponce tryed
the Mozilla control instead but at that time it was indeed less
demanding on memory but it was verry unstable i do not know how this
is now at this time .
>
I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is
for these projects
>
>
A workaround could be to set the process working setsize of your
project once in a while ,than you get the same behaviour as minimizing
and maximizing the application by hand ( try it out and watch the
memory usage )
>
as long as the application domain is loaded the memory will be
reserved
for further processing
>
>
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back
and
needs to be reclaimed )
>
>
with a windows form application you can see this behavior to ( or did
you
really thought a clean form needs about +- 25 megs in .Net ? )
>
>
there is a way you can bypass this behavior however it comes with a
small
price ,,,,
i wrote once a remoting project , and had my customer complaining
about the
memory consumption , so i digged a litle bit deeper and came with this
solution
>
>
my project ( wich is a singleton ) starts a timer that periodicly
checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call
SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry
VB.Net
-) )
>
>
Private M_dtLastUsage As DateTime
>
>
Private oCallback As New TimerCallback(AddressOf OnTick)
>
>
Private oTimer As Threading.Timer
>
>
Public Sub OnTick(ByVal stateInfo As Object)
>
>
Dim DtCurrent As DateTime = Date.Now
>
>
Dim elapsed_time As TimeSpan
>
>
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
>
>
If elapsed_time.TotalMinutes >= 1 Then
>
>
oTimer.Dispose() : oTimer = Nothing
>
>
SetProcessWorkingSetSize()
>
>
End If
>
>
End Sub
>
>
Public Sub New()
>
>
M_dtLastUsage = Date.Now
>
>
If IsNothing(oTimer) Then
>
>
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
>
>
End If
>
>
End Sub
>
>
Private Declare Auto Function SetProcessWorkingSetSize Lib
"kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32)
As
Boolean
>
>
Friend Sub SetProcessWorkingSetSize()
>
>
Try
>
>
Dim Mem As Process = Process.GetCurrentProcess()
>
>
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
>
>
Catch ex As Exception
>
>
End Try
>
>
End Sub
>
>
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower
as it
could be.
>
>
So it is more cosmetical as that it does really have a purpose as the
prog
is actually gone to the swap same as a minimized application (
physical and
virtual memory thingy )
>
>
>
>
>
HTH
>
Michel Posseth
>
>
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl.. .
>Hello people. I'm having a Winform app that contains a webbrowser
>control
>that keeps navigating from one page to another permanentrly to make
>some
>tests. The problem I'm having is that after a while, the application
>is
>using more than 100 or 150 Mb in RAM, and if I let it continue, it
>can leave
>the system without memory. I've been watching in some pages that
>other
>people has the same problem with this control when keep navigating
>for a
>long period of time, but I've seen no answers at all about it...
>>
>Does anyone here has an answer for this control's behaviour?? I've
>tried
>everything to reduce the memory use in the application but as the
>webbrowser
>navigates more and more, the memory use of the application keeps
>increasing...
>>
>Thanks in advance.
>>
>Regards.
>>
>Cesar.
>>
>>
>>
>


Synthetic ??? wel if you read my message you see that i call it myself
Cosmetic :-) , i also point out why

HTH
Michel

Jun 27 '08 #10
Michel,

Task manager is entirely appropriate for checking *real*
memory use of a .net app. .net applications run as win32
processes just like any other--the "managed" application is
a concept created inside of the outer shell of the normal
unmanaged process.

Task manager can be used to show the user the .net app's
working set, private bytes, paged pool, etc.--these are all
very relevant when considering how much resources
are being used. It is true that task manager does not tell
you *everything* about resource use (one example
is that it doesn't show much memory is shared).

Think about it for a moment. From the managed perspective
the .net memory counters are more important, but what
*really* counts is the win32 memory/resources allocated by
the process. The end user is not running a "managed" OS
where the only memory allocated is "managed" memory.

You could have a .net application that uses a small
amount of managed memory (for example, say all of the
..net heaps add up to less than 20MB), but still have an
application that uses over a gig of RAM or more while it is
running.

This is something I have seen first hand when using the
activex web control. I recently created an application
with a single form that contained the activex web browser
control. Essentially all it does is call Refresh on the control
every 20 minutes. It steadily uses more and more memory
the longer it runs. The user is restricted to one web site that
contains no flash or other plugin content, however, it does
include a medium amount of javascript.

Such excessive use of memory eventually slows the
entire machine down due to hard paging and if not
corrected the app will crash (when it reaches 1-2Gigs).
This takes more than a week of uptime so I programmed
it to automatically terminate in the middle of the night to
prevent users from leaving it running too long.

I recommend you read chapter 7 "Memory Management"
as well as complete the experiments for a better understanding:

http://www.amazon.com/Microsoft-Wind...dp/0735619174/

Note that on Vista and Server 2008 the task manager
now defaults to showing Private Bytes for each process
instead of working set. Private Bytes will not be reduced
by the technique you posted.

The "solution" you posted at best will slow the app down
a little bit (imperceptable to the user), and at worst
(in memory-constrained circumstances) will make
certain that the app is even more sluggish than it would be.
This is because it will be more likely to have its pages
located in the page file.

J

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:eQ****************@TK2MSFTNGP06.phx.gbl...
Taskmanager shouldn`t be used to check for "reall" memory consumption of
.Net apps , however sorry for us the end user doesn`t know this and starts
complaining that is why i introduced the previous trick in some of my apps
.


Michel

Jun 27 '08 #11
Hi Cesar,

Which versions of the framework, IE, OS are
being used?

Please post a small sample that demonstrates the
problem.

I too have seen memory leaks with this control, but in
my case I am using the activex so that I can access
some additional events. Simply calling Refresh repeatedly
causes memory to rise unchecked.

Thanks.

J

"Cesar" <cesardemi @ yahoo . com . arwrote in message
news:eQ**************@TK2MSFTNGP03.phx.gbl...
Hello people. I'm having a Winform app that contains a webbrowser control
that keeps navigating from one page to another permanentrly to make some
tests. The problem I'm having is that after a while, the application is
using more than 100 or 150 Mb in RAM, and if I let it continue, it can
leave
the system without memory. I've been watching in some pages that other
people has the same problem with this control when keep navigating for a
long period of time, but I've seen no answers at all about it...

Does anyone here has an answer for this control's behaviour?? I've tried
everything to reduce the memory use in the application but as the
webbrowser
navigates more and more, the memory use of the application keeps
increasing...

Thanks in advance.

Regards.

Cesar.

Jun 27 '08 #12
Maybe this helps,

http://groups.google.nl/group/micros...+in+deze+groep

Cor
"John" <jo**@donotspam.invalidschreef in bericht
news:u0**************@TK2MSFTNGP05.phx.gbl...
Michel,

Task manager is entirely appropriate for checking *real*
memory use of a .net app. .net applications run as win32
processes just like any other--the "managed" application is
a concept created inside of the outer shell of the normal
unmanaged process.

Task manager can be used to show the user the .net app's
working set, private bytes, paged pool, etc.--these are all
very relevant when considering how much resources
are being used. It is true that task manager does not tell
you *everything* about resource use (one example
is that it doesn't show much memory is shared).

Think about it for a moment. From the managed perspective
the .net memory counters are more important, but what
*really* counts is the win32 memory/resources allocated by
the process. The end user is not running a "managed" OS
where the only memory allocated is "managed" memory.

You could have a .net application that uses a small
amount of managed memory (for example, say all of the
.net heaps add up to less than 20MB), but still have an
application that uses over a gig of RAM or more while it is
running.

This is something I have seen first hand when using the
activex web control. I recently created an application
with a single form that contained the activex web browser
control. Essentially all it does is call Refresh on the control
every 20 minutes. It steadily uses more and more memory
the longer it runs. The user is restricted to one web site that
contains no flash or other plugin content, however, it does
include a medium amount of javascript.

Such excessive use of memory eventually slows the
entire machine down due to hard paging and if not
corrected the app will crash (when it reaches 1-2Gigs).
This takes more than a week of uptime so I programmed
it to automatically terminate in the middle of the night to
prevent users from leaving it running too long.

I recommend you read chapter 7 "Memory Management"
as well as complete the experiments for a better understanding:

http://www.amazon.com/Microsoft-Wind...dp/0735619174/

Note that on Vista and Server 2008 the task manager
now defaults to showing Private Bytes for each process
instead of working set. Private Bytes will not be reduced
by the technique you posted.

The "solution" you posted at best will slow the app down
a little bit (imperceptable to the user), and at worst
(in memory-constrained circumstances) will make
certain that the app is even more sluggish than it would be.
This is because it will be more likely to have its pages
located in the page file.

J

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:eQ****************@TK2MSFTNGP06.phx.gbl...
>Taskmanager shouldn`t be used to check for "reall" memory consumption of
.Net apps , however sorry for us the end user doesn`t know this and
starts complaining that is why i introduced the previous trick in some of
my apps .


Michel


Jun 27 '08 #13
I too have seen memory leaks with this control, but in
my case I am using the activex so that I can access
some additional events. Simply calling Refresh repeatedly
causes memory to rise unchecked.
Probably you did something wrong, however cover that with plaster does not
heal the wound.

Cor
Jun 27 '08 #14

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:33**********************************@microsof t.com...
Michel,

You did, and I saw it, however I thought that you was meaning that there
was really some memory cleaned. AFAIK , is the cosmetic part only
takskmanager.

:-)

Cor

"Michel Posseth" <ms****@posseth.comschreef in bericht
news:uU**************@TK2MSFTNGP03.phx.gbl...
>Cor Ligthert [MVP] schreef:
>>synthetic

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:0D**********************************@micros oft.com...
Michael,

Is this not the syntatical solution to let the taskmanager show the
actual in used memory.

That was why I asked what was the problem instead of every time, how do
you know that the memory consumption is high, the taskmanager is not
meant as a development tool.

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:eN****************@TK2MSFTNGP06.phx.gbl. ..
The webbrowser control is a memory hungry control , i have ponce tryed
the Mozilla control instead but at that time it was indeed less
demanding on memory but it was verry unstable i do not know how this
is now at this time .
>
I had once understood that Mozilla and MS were planning a lightweight
control for showing html pages but i do not know what the status is
for these projects
>
>
A workaround could be to set the process working setsize of your
project once in a while ,than you get the same behaviour as minimizing
and maximizing the application by hand ( try it out and watch the
memory usage )
>
as long as the application domain is loaded the memory will be
reserved
for further processing
>
>
if your comp would run low on resources and the app does not need the
memory
at the moment ( cause it is idle ,,, the memory would be given back
and
needs to be reclaimed )
>
>
with a windows form application you can see this behavior to ( or did
you
really thought a clean form needs about +- 25 megs in .Net ? )
>
>
there is a way you can bypass this behavior however it comes with a
small
price ,,,,
i wrote once a remoting project , and had my customer complaining
about the
memory consumption , so i digged a litle bit deeper and came with this
solution
>
>
my project ( wich is a singleton ) starts a timer that periodicly
checks a
datetime var to see how manny time has passed after it was last called
if this intervall is >= 1 minute it will call
SetProcessWorkingSetSize()
wich will trim the data usage to a minimum see below code ( sorry
VB.Net
-) )
>
>
Private M_dtLastUsage As DateTime
>
>
Private oCallback As New TimerCallback(AddressOf OnTick)
>
>
Private oTimer As Threading.Timer
>
>
Public Sub OnTick(ByVal stateInfo As Object)
>
>
Dim DtCurrent As DateTime = Date.Now
>
>
Dim elapsed_time As TimeSpan
>
>
elapsed_time = DtCurrent.Subtract(M_dtLastUsage)
>
>
If elapsed_time.TotalMinutes >= 1 Then
>
>
oTimer.Dispose() : oTimer = Nothing
>
>
SetProcessWorkingSetSize()
>
>
End If
>
>
End Sub
>
>
Public Sub New()
>
>
M_dtLastUsage = Date.Now
>
>
If IsNothing(oTimer) Then
>
>
oTimer = New System.Threading.Timer(oCallback, Nothing,
System.TimeSpan.FromMinutes(0), System.TimeSpan.FromMinutes(1))
>
>
End If
>
>
End Sub
>
>
Private Declare Auto Function SetProcessWorkingSetSize Lib
"kernel32.dll"
(ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32)
As
Boolean
>
>
Friend Sub SetProcessWorkingSetSize()
>
>
Try
>
>
Dim Mem As Process = Process.GetCurrentProcess()
>
>
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
>
>
Catch ex As Exception
>
>
End Try
>
>
End Sub
>
>
The drawback of this method is that the framework needs to reclaim the
memory again so in theory your prog should be a few miliseconds slower
as it
could be.
>
>
So it is more cosmetical as that it does really have a purpose as the
prog
is actually gone to the swap same as a minimized application (
physical and
virtual memory thingy )
>
>
>
>
>
HTH
>
Michel Posseth
>
>
"Cesar" <cesardemi @ yahoo . com . arschreef in bericht
news:eQ**************@TK2MSFTNGP03.phx.gbl.. .
>Hello people. I'm having a Winform app that contains a webbrowser
>control
>that keeps navigating from one page to another permanentrly to make
>some
>tests. The problem I'm having is that after a while, the application
>is
>using more than 100 or 150 Mb in RAM, and if I let it continue, it
>can leave
>the system without memory. I've been watching in some pages that
>other
>people has the same problem with this control when keep navigating
>for a
>long period of time, but I've seen no answers at all about it...
>>
>Does anyone here has an answer for this control's behaviour?? I've
>tried
>everything to reduce the memory use in the application but as the
>webbrowser
>navigates more and more, the memory use of the application keeps
>increasing...
>>
>Thanks in advance.
>>
>Regards.
>>
>Cesar.
>>
>>
>>
>


Synthetic ??? wel if you read my message you see that i call it myself
Cosmetic :-) , i also point out why

HTH
Michel
I believe this is the behaviour of the dll (can't remember the name) that is
used both by the .net component and COM. My morning ritual is to view local
online newpaper and RSS feeds which lead to other stories. I have been
watching this thread so this morning I looked and after about looking at 50
different pages the memory usage reported for IExplorer has increased from
about 32K to over 200K. It will never go down until I close IE. This is
constant behaviour. Lets say I download an item. While the dialog showing
the download is active I can close the GUI for IE but it is still there and
memory will increase as it downloads.

This leads me to believe that the only way to have the memory drop might be
to remove the control from the form and re-add it. Haven't tried this but
it might work.

LS

Jun 27 '08 #15
This is discussed so often since the beta versions of .Net
and AFAIK it shows the workingset and you should use performance monitor to
watch for the "really used " values
Proof ??

create a new project containing one clean, now start this project in
compiled form ( exe ) look at the taskmanager
huh ??? i hear you say ,,, 25 + MB for only one simple form !!!

Now minimize the app , wait until the app memory drops , now maximize the
app and see the memory usage
seeing anny difference ??

You have just manually mimicked the behavior of my previously posted code
( it does exactly the same from code without the min / maximizing )
the program is swapped to the page file , and on reshow it needs to reclaim
physical memory .
The rest of the bla blah blah you might find in postings from years ago but
a quick google might bring them back

I could start a lecture here about application domains and how memory
management works in .Net but the point is you are wrong ( sorry ) :-)

regards

Michel Posseth [MCP]


"John" <jo**@donotspam.invalidschreef in bericht
news:u0**************@TK2MSFTNGP05.phx.gbl...
Michel,

Task manager is entirely appropriate for checking *real*
memory use of a .net app. .net applications run as win32
processes just like any other--the "managed" application is
a concept created inside of the outer shell of the normal
unmanaged process.

Task manager can be used to show the user the .net app's
working set, private bytes, paged pool, etc.--these are all
very relevant when considering how much resources
are being used. It is true that task manager does not tell
you *everything* about resource use (one example
is that it doesn't show much memory is shared).

Think about it for a moment. From the managed perspective
the .net memory counters are more important, but what
*really* counts is the win32 memory/resources allocated by
the process. The end user is not running a "managed" OS
where the only memory allocated is "managed" memory.

You could have a .net application that uses a small
amount of managed memory (for example, say all of the
.net heaps add up to less than 20MB), but still have an
application that uses over a gig of RAM or more while it is
running.

This is something I have seen first hand when using the
activex web control. I recently created an application
with a single form that contained the activex web browser
control. Essentially all it does is call Refresh on the control
every 20 minutes. It steadily uses more and more memory
the longer it runs. The user is restricted to one web site that
contains no flash or other plugin content, however, it does
include a medium amount of javascript.

Such excessive use of memory eventually slows the
entire machine down due to hard paging and if not
corrected the app will crash (when it reaches 1-2Gigs).
This takes more than a week of uptime so I programmed
it to automatically terminate in the middle of the night to
prevent users from leaving it running too long.

I recommend you read chapter 7 "Memory Management"
as well as complete the experiments for a better understanding:

http://www.amazon.com/Microsoft-Wind...dp/0735619174/

Note that on Vista and Server 2008 the task manager
now defaults to showing Private Bytes for each process
instead of working set. Private Bytes will not be reduced
by the technique you posted.

The "solution" you posted at best will slow the app down
a little bit (imperceptable to the user), and at worst
(in memory-constrained circumstances) will make
certain that the app is even more sluggish than it would be.
This is because it will be more likely to have its pages
located in the page file.

J

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:eQ****************@TK2MSFTNGP06.phx.gbl...
>Taskmanager shouldn`t be used to check for "reall" memory consumption of
.Net apps , however sorry for us the end user doesn`t know this and
starts complaining that is why i introduced the previous trick in some of
my apps .


Michel


Jun 27 '08 #16
Michel,

Are you that guy who posted some years ago something as, "Thanks, I know it
does not help, but my System Admininstrator is happy now?

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:ud**************@TK2MSFTNGP06.phx.gbl...
This is discussed so often since the beta versions of .Net
and AFAIK it shows the workingset and you should use performance monitor
to watch for the "really used " values
Proof ??

create a new project containing one clean, now start this project in
compiled form ( exe ) look at the taskmanager
huh ??? i hear you say ,,, 25 + MB for only one simple form !!!

Now minimize the app , wait until the app memory drops , now maximize the
app and see the memory usage
seeing anny difference ??

You have just manually mimicked the behavior of my previously posted code
( it does exactly the same from code without the min / maximizing )
the program is swapped to the page file , and on reshow it needs to
reclaim physical memory .
The rest of the bla blah blah you might find in postings from years ago
but a quick google might bring them back

I could start a lecture here about application domains and how memory
management works in .Net but the point is you are wrong ( sorry ) :-)

regards

Michel Posseth [MCP]


"John" <jo**@donotspam.invalidschreef in bericht
news:u0**************@TK2MSFTNGP05.phx.gbl...
>Michel,

Task manager is entirely appropriate for checking *real*
memory use of a .net app. .net applications run as win32
processes just like any other--the "managed" application is
a concept created inside of the outer shell of the normal
unmanaged process.

Task manager can be used to show the user the .net app's
working set, private bytes, paged pool, etc.--these are all
very relevant when considering how much resources
are being used. It is true that task manager does not tell
you *everything* about resource use (one example
is that it doesn't show much memory is shared).

Think about it for a moment. From the managed perspective
the .net memory counters are more important, but what
*really* counts is the win32 memory/resources allocated by
the process. The end user is not running a "managed" OS
where the only memory allocated is "managed" memory.

You could have a .net application that uses a small
amount of managed memory (for example, say all of the
.net heaps add up to less than 20MB), but still have an
application that uses over a gig of RAM or more while it is
running.

This is something I have seen first hand when using the
activex web control. I recently created an application
with a single form that contained the activex web browser
control. Essentially all it does is call Refresh on the control
every 20 minutes. It steadily uses more and more memory
the longer it runs. The user is restricted to one web site that
contains no flash or other plugin content, however, it does
include a medium amount of javascript.

Such excessive use of memory eventually slows the
entire machine down due to hard paging and if not
corrected the app will crash (when it reaches 1-2Gigs).
This takes more than a week of uptime so I programmed
it to automatically terminate in the middle of the night to
prevent users from leaving it running too long.

I recommend you read chapter 7 "Memory Management"
as well as complete the experiments for a better understanding:

http://www.amazon.com/Microsoft-Wind...dp/0735619174/

Note that on Vista and Server 2008 the task manager
now defaults to showing Private Bytes for each process
instead of working set. Private Bytes will not be reduced
by the technique you posted.

The "solution" you posted at best will slow the app down
a little bit (imperceptable to the user), and at worst
(in memory-constrained circumstances) will make
certain that the app is even more sluggish than it would be.
This is because it will be more likely to have its pages
located in the page file.

J

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:eQ****************@TK2MSFTNGP06.phx.gbl...
>>Taskmanager shouldn`t be used to check for "reall" memory consumption of
.Net apps , however sorry for us the end user doesn`t know this and
starts complaining that is why i introduced the previous trick in some
of my apps .


Michel


Jun 27 '08 #17
euhhhmmm ... not that i ( or google ) can recall at this moment ( could be )

I believe i was the one saying "my customers are happy now" as this was were
the problem that occured with me , customers complaining of the high memory
usage in taskmanager when we released a new VB.Net project to replace a VB6
prog

Funny to see that i indeed always called it a cosmetic problem ( google
brought this back since 2005 ) ,and indeed if a program really needs the
amount of process space it sure doesn`t help, calling the
setprocesworkingsetsize will only degrade the perfomance of the app

But keeping your customers happy is worth a price ,,,, :-|

Michel :-)

"Cor Ligthert[MVP]" <no************@planet.nlschreef in bericht
news:38**********************************@microsof t.com...
Michel,

Are you that guy who posted some years ago something as, "Thanks, I know
it does not help, but my System Admininstrator is happy now?

Cor

"Michel Posseth [MCP]" <MS**@posseth.comschreef in bericht
news:ud**************@TK2MSFTNGP06.phx.gbl...
>This is discussed so often since the beta versions of .Net
and AFAIK it shows the workingset and you should use performance monitor
to watch for the "really used " values
Proof ??

create a new project containing one clean, now start this project in
compiled form ( exe ) look at the taskmanager
huh ??? i hear you say ,,, 25 + MB for only one simple form !!!

Now minimize the app , wait until the app memory drops , now maximize the
app and see the memory usage
seeing anny difference ??

You have just manually mimicked the behavior of my previously posted code
( it does exactly the same from code without the min / maximizing )
the program is swapped to the page file , and on reshow it needs to
reclaim physical memory .
The rest of the bla blah blah you might find in postings from years ago
but a quick google might bring them back

I could start a lecture here about application domains and how memory
management works in .Net but the point is you are wrong ( sorry ) :-)

regards

Michel Posseth [MCP]


"John" <jo**@donotspam.invalidschreef in bericht
news:u0**************@TK2MSFTNGP05.phx.gbl...
>>Michel,

Task manager is entirely appropriate for checking *real*
memory use of a .net app. .net applications run as win32
processes just like any other--the "managed" application is
a concept created inside of the outer shell of the normal
unmanaged process.

Task manager can be used to show the user the .net app's
working set, private bytes, paged pool, etc.--these are all
very relevant when considering how much resources
are being used. It is true that task manager does not tell
you *everything* about resource use (one example
is that it doesn't show much memory is shared).

Think about it for a moment. From the managed perspective
the .net memory counters are more important, but what
*really* counts is the win32 memory/resources allocated by
the process. The end user is not running a "managed" OS
where the only memory allocated is "managed" memory.

You could have a .net application that uses a small
amount of managed memory (for example, say all of the
.net heaps add up to less than 20MB), but still have an
application that uses over a gig of RAM or more while it is
running.

This is something I have seen first hand when using the
activex web control. I recently created an application
with a single form that contained the activex web browser
control. Essentially all it does is call Refresh on the control
every 20 minutes. It steadily uses more and more memory
the longer it runs. The user is restricted to one web site that
contains no flash or other plugin content, however, it does
include a medium amount of javascript.

Such excessive use of memory eventually slows the
entire machine down due to hard paging and if not
corrected the app will crash (when it reaches 1-2Gigs).
This takes more than a week of uptime so I programmed
it to automatically terminate in the middle of the night to
prevent users from leaving it running too long.

I recommend you read chapter 7 "Memory Management"
as well as complete the experiments for a better understanding:

http://www.amazon.com/Microsoft-Wind...dp/0735619174/

Note that on Vista and Server 2008 the task manager
now defaults to showing Private Bytes for each process
instead of working set. Private Bytes will not be reduced
by the technique you posted.

The "solution" you posted at best will slow the app down
a little bit (imperceptable to the user), and at worst
(in memory-constrained circumstances) will make
certain that the app is even more sluggish than it would be.
This is because it will be more likely to have its pages
located in the page file.

J

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:eQ****************@TK2MSFTNGP06.phx.gbl.. .
Taskmanager shouldn`t be used to check for "reall" memory consumption
of .Net apps , however sorry for us the end user doesn`t know this and
starts complaining that is why i introduced the previous trick in some
of my apps .


Michel



Jun 27 '08 #18

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

Similar topics

7
by: Noozer | last post by:
I am able to place values on forms that load into my webbrowser control, but I'd like to be able to scan the page for data. I know to use the HTMLDocument object. Basically I'm hoping to find an...
2
by: frederik12 | last post by:
Hi all, Today I downloaded and installed VS 2005 C# Express Edition (.NET framework 2.0). I'm very pleased about this new product. In my current application I'm using the WebBrowser control in...
9
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
3
by: clintonG | last post by:
I'd like to know if it is possible to reuse the WebBrowser control in a page? The idea being the retrieval of your.homepage that can then be converted to an image displayed in my.homepage where...
0
by: Jim Hubbard | last post by:
How would I implement the IDispatch interface to handle the following in VB.Net <BEGIN> Controlling Download and Execution The WebBrowser Control gives you control over what it downloads,...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
7
by: Vittorio | last post by:
Hi all, I am trying to avoid that a webbrowser object will be closed by a window.close() javascript. Trying to use the WindowClosing event i discovered that it is not fired. I am using VB.NET 1.1...
5
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
6
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.