C++ DLL in C# and allocating memory-Collection of common programming errors

I have added C++ DLL to my C# project, using DLLImport. Works fine, buf inside DLL is allocated more than 2GB of memory. C# program running with this library failed and crashed.

If I build dll library as exe in C++ and run it, no memory problem occur. Libray is builded with “/LARGEADDRESSAWARE” in Linker settings.

Is there a way how to use this library within C# without crash ?

Thank you