Re: Program Memory Low - Select a task to close or increase progra
- From: Alex Yakhnin [MVP] <a.yakhnin@xxxxxxxxxxxxxx>
- Date: Fri, 13 Jan 2006 12:15:02 -0800
Why don't you run the check before your program allocates some memory?
Also, take a look at this post:
http://blog.opennetcf.org/ayakhnin/PermaLink.aspx?guid=f1df04aa-99c0-4e2a-906d-6fcf0c4b0d59
--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org
"Tsviatko Yovtchev" wrote:
> Yeah it is really not pretty :)
>
> The problem is that it is not guaranteed to detect the exact moment when
> the app runs out of memory. So, it would not prevent the app from
> falling into the same nasty loop I described in my first message. And
> that is definitely something I do not want my users to see.
>
> Erwin van Hunen wrote:
> > What about running the check for memory in a separate thread and have it
> > check at certain intervals?
> >
> > It's for sure not 'pretty' but you can you register some events and have
> > your thread invoke them the memory becomes critical.
> >
> > /Erwin
> >
> > Tsviatko Yovtchev wrote:
> >> Hi Erwin,
> >>
> >> Thanks for the quick reply. I've considered this approach, but the
> >> problem with it is that it is hard find out exactly when there is
> >> absolutely no more memory available. The garbage collector hits in at
> >> some point and increases the amount of available memory for one thing.
> >> So, I have to put P/Invoke calls to GlobalMemoryStatus before every
> >> allocation which will make my code tremendously slow.
> >>
> >> I was thinking more along the lines of some event or callback function
> >> that occur when there is no more memory, but I could not find anything
> >> of the kind.
> >>
> >>
> >> Erwin van Hunen wrote:
> >>> Hi!
> >>>
> >>> You will have use P/Invoke code to find out about available memory.
> >>> Check this out:
> >>>
> >>> http://msdn2.microsoft.com/en-us/library/ms172518.aspx
> >>>
> >>> /Erwin
> >>>
> >>> Tsviatko Yovtchev wrote:
> >>>> I've been putting my application(C#, .NET CF) through some stress
> >>>> testing when I encountered this pretty nasty problem.
> >>>>
> >>>> Basically, when the application runs out of memory I get the
> >>>> "Program Memory Low - Select a task to close or increase program
> >>>> memory" dialog window with a list of running tasks that I can close
> >>>> to choose from. My app, however is NOT listed there. So, if I close
> >>>> everything else and my app still needs more memory I keep getting
> >>>> instances of this dialog window with nothing to choose from until
> >>>> eventually the whole system crashes at which point I need to do a
> >>>> restart.
> >>>>
> >>>> So, it looks like I'll have to handle this problem inside my
> >>>> application. The problem is I could not find a way to
> >>>> programatically determine the amount of free memory at a given point
> >>>> of time. I also could not find any event that occurs when there is
> >>>> no more free memory which I could handle inside my app.
> >>>>
> >>>> Does anybody have any idea how I can handle this problem?
>
.
- Follow-Ups:
- Re: Program Memory Low - Select a task to close or increase progra
- From: Tsviatko Yovtchev
- Re: Program Memory Low - Select a task to close or increase progra
- References:
- Program Memory Low - Select a task to close or increase program memory
- From: Tsviatko Yovtchev
- Re: Program Memory Low - Select a task to close or increase program memory
- From: Erwin van Hunen
- Re: Program Memory Low - Select a task to close or increase program memory
- From: Tsviatko Yovtchev
- Re: Program Memory Low - Select a task to close or increase program memory
- From: Erwin van Hunen
- Re: Program Memory Low - Select a task to close or increase program memory
- From: Tsviatko Yovtchev
- Program Memory Low - Select a task to close or increase program memory
- Prev by Date: Re: ClickOnce installation
- Next by Date: Re: Control.Validating - Am I missing something (or did Microsoft) ?
- Previous by thread: Re: Program Memory Low - Select a task to close or increase program memory
- Next by thread: Re: Program Memory Low - Select a task to close or increase progra
- Index(es):
Relevant Pages
|