PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Handling Out-of-memory Condition in .NET CF 1.1

Reply

Handling Out-of-memory Condition in .NET CF 1.1

 
Thread Tools Rate Thread
Old 17-01-2006, 02:28 PM   #1
Tsviatko Yovtchev
Guest
 
Posts: n/a
Default Handling Out-of-memory Condition in .NET CF 1.1


I have serious trouble handling gracefully the out-of-memory condition
using .NET CF 1.1.

First of all, I could not find a way to intercept the WM_HIBERNATE
message(I could not think of a way to do it even using Win32) which
means that my app is clueless as of when the system runs out of memory.

Second, and even worse, if the system runs out of memory while my app
has not constructed its main form yet(e.g. during InitializeComponent()
call in a form has many controls) I cannot even get the WM_HIBERNATE.
And even worse than that - if in this moment the system displays the
out-of-memory dialog(OOM) my app is not listed there since it has no
window yet. So, the user does not even get the option to stop it.

Generally, I could not find any consistent way to detect or handle the
out-of-memory conditions. The Win32 functions like GlobalMemoryStatus
and SHCloseApps are no good either because their results are highly
volatile, i.e. more memory can be released or consumed by some process
right after they return.

Can somebody offer some assistance?
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off