A
A
askeet2013-04-16 08:47:30
.NET
askeet, 2013-04-16 08:47:30

How to catch system out of virtual memory exception in .NET 2.0?

In the process of using third-party unmanaged libraries, large memory overheads are possible. To improve the overall reliability of the software, it is necessary to reboot the system when the amount of built-in RAM is exceeded, as possible. NET? Is there a mechanism to intercept the system dialog box in the Virtual Memory Low program?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
deleted-Brazier, 2013-04-16
@deleted-Brazier

You can run a .NET application manually from C++, then you will have full control over the life cycle of the .NET machine and the ability to catch any critical errors - StackOverflow, OutOfMemory, etc.
Here is an example:
code.msdn.microsoft.com/CppHostCLR-e6581ee0
UPDATE: I confess I did not
read the question carefully. My answer is completely different :(

A
askeet, 2013-04-16
@askeet

Thanks for answers. There was an idea about the implementation of general memory monitoring in the application, apparently its implementation here will be optimal. It remains only the technical side of the polling frequency and so on, in case of allocation of a large memory block exceeding the memory limit.
At the expense of checking why GC did not understand. But the leak is at the initial access (calling functions) in dll. Maybe you can completely unload it from memory?
For example, a class is used for access.

public class DLL{
 ....
        [DllImport(VIDEODLL, EntryPoint = "#6", CallingConvention = CallingConvention.Cdecl)]
        public static extern byte dllTestConnection(string address); // проверка соединения с сервером.
....
} 

R
Roman_Pekhov, 2013-04-16
@Roman_Pekhov

I would not write any code at all, but set up an alert data collector . We take the instruction Create a group of data collectors to monitor performance counters In paragraph 6a, we use the counter "Memory \ Available MB". Below in the paragraph “To configure alerts”, we can not do point 5 at all, and in point 6 we indicate the command Will this approach suit?

A
askeet, 2013-04-17
@askeet

Destination: Windows 7, Windows Server 2008 R2, Windows Vista
The fact is that the assembly based on Windows XP SP3 is used as the target system. Therefore, this solution does not apply here.

R
Roman_Pekhov, 2013-04-17
@Roman_Pekhov

Why are you so unfocused ... The option for XP could be googled on your own.
Configuring Administrative Alerts in Windows XP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question