[Mono-dev] glibc detected *** mono: double free or corruption

StApostol stapostol at gmail.com
Mon Oct 15 09:25:19 EDT 2007

I am receiving the same error message, but in my case I think it is linked
to pinvoking an array of strings (string[]). The error occurs during garbage
collection/object disposal, at application shutdown.

I do have a somewhat simple test-case, but unfortunately it is part of a
larger project. You can download the source code and (release) binaries from
the following link:


Execute Examples.exe and select "Tutorial 10: GLSL Cube" from the listbox.
The error occurs during applicaton shutdown.

The source code for the example can be found online at:
the OnLoad and OnUnload functions).

It seems likely that the problem is linked with the marshalling of structs.
In my case, this happens with the GL.ShaderSource() function inside the
OnLoad method. Its pinvoke signature is as follows:

[DllImport(GL.Library, EntryPoint = "glShaderSource", ExactSpelling = true),
internal extern static unsafe void ShaderSource(UInt32 shader, Int32 count,
System.String[] @string, Int32* length);

The C signature is:

void glShaderSource(GLuint shader, GLsizei count, const GLchar **string,
const GLint *length)

Any ideas? I can provide more information as necessary, but I don't believe
I can rewrite a more minimal test-case.

On 10/15/07, Rolf Bjarne Kvinge <rolflists at ya.com> wrote:
> >From: mono-devel-list-bounces at lists.ximian.com
> [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Abir
> Bhattacharya
> >Sent: lunes, 15 de octubre de 2007 15:00
> >To: mono-devel-list at lists.ximian.com
> >Subject: [Mono-dev] glibc detected *** mono: double free or corruption
> >
> >Hi All,
> >
> >Am receiving an native crash error like : *** glibc detected *** mono:
> double free or corruption (!prev): 0x08726100 ***. I am trying to call a
> PInvoke to a 'C' method which returns me a struct. I am using Fedora (2.6)
> and have >installed mono from the standard installer :
> Could you attach the C and C# code necessary to reproduce this?
> Otherwise it's impossible to tell where the problem is.
> Rolf
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071015/2ba64096/attachment.html 

More information about the Mono-devel-list mailing list