MPIon
Well-known member
I have a 2d array defined in the form :-
The second dimension is created as follows :-
Periodically due to memory issues, I need to clear a block and allocate a new one, so I was using
(hoping the garbage collector would free the memory.
This does work, but moving a project from Net FrameWork to Net 7, I am getting warnings on the blockData = null line -
Cannot convert null literal to non-nullable reference type.
(there are no such warnings in the Net FrameWork version).
I don't like warnings in my code, so presumably I am not doing something quite right. Perhaps I don't need to set the blockData to null at all and the grabage collector will automatically clear the memory when I assign a new block to it?
C#:
static byte[][] blockData = new byte[1000][];
The second dimension is created as follows :-
C#:
blockData[i] = new byte[<block size>];
Periodically due to memory issues, I need to clear a block and allocate a new one, so I was using
C#:
blockData[i] = null;
This does work, but moving a project from Net FrameWork to Net 7, I am getting warnings on the blockData = null line -
Cannot convert null literal to non-nullable reference type.
(there are no such warnings in the Net FrameWork version).
I don't like warnings in my code, so presumably I am not doing something quite right. Perhaps I don't need to set the blockData to null at all and the grabage collector will automatically clear the memory when I assign a new block to it?