我从托管代码调用本机mpi库,并且(偶尔)系统崩溃只显示托管和本机堆栈跟踪。这只发生在排队交换大量大量消息时。 (排队意味着可以发送不超过n条大消息和/或任何进程同时接收大量消息)
我怀疑的是,在C#中创建的消息仍保留在内存中(等待GC收集),并且在调用本机库期间无法收集。因此,当MPI_Alloc_mem请求内存时,安装程序崩溃。
调用
GC.Collect();
GC.WaitForPendingFinalizers();
在发送和/或接收的每条消息都不是我的程序设计的选项之前,所以我很好奇是否有办法估计如果我现在调用垃圾收集器将释放多少内存。
非常感谢,
BENJ
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) MPI.Unsafe.MPI_Alloc_mem (intptr,intptr,intptr&) <0xffffffff>
at MPI.UnmanagedMemoryStream.AllocateMemory (long,bool&) <0x0004f>
at MPI.UnmanagedMemoryStream.Reserve (long) <0x0004f>
at MPI.UnmanagedMemoryStream.Write (byte[],int,int) <0x0007f>
at System.IO.BinaryWriter.Write (int) <0x00094>
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.WriteBinaryHeader (System.IO.BinaryWriter,bool) <0x00064>
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream,object,System.Runtime.Remoting.Messaging.Header[]) <0x00079>
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize (System.IO.Stream,object) <0x00018>
at MPI.Communicator.ImmediateSend<T> (T,int,int) <0x000fa>
at [somewhere in my program]
Native stacktrace:
mono() [0x4a4305]
mono() [0x4ff65f]
mono() [0x416099]
/lib64/libpthread.so.0() [0x349de0f4a0]
/gpfs/packages/gcc/openmpi/1.6/lib/libmpi.so(ompi_rb_tree_insert+0x1a) [0x2aaaacd71a5a]
/gpfs/packages/gcc/openmpi/1.6/lib/libmpi.so(mca_mpool_base_alloc+0x402) [0x2aaaace2bc42]
/gpfs/packages/gcc/openmpi/1.6/lib/libmpi.so(PMPI_Alloc_mem+0x9b) [0x2aaaacd914bb]
[0x4132b6dc]
Debug info from gdb:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================