Memory allocation in c #

  • Can the failure of using the new operator in C # fail (if, for example, large memory is required)? -Solved -
  • And how to find it? -Solved -
  • What other errors can new operators cause?

thank

+3
source share
4 answers
Operator

A new, which the constructor calls, can throw any exception that you can imagine. For example, if inside the constructor he tries to isolate something big and fails, then this exception can be caught and re-raised as something more exotic.

, , , , , , .

, , null , , .

+4

new , OutOfMemoryException. , .

MSDN OutOfMemoryException:

Microsoft (MSIL) OutOfMemoryException:

  • newarr

  • newobj

+9

new # ( )?

. (, , , , - , .)

?

.

+1

Source: https://habr.com/ru/post/1742347/


All Articles