[Mono-osx] OutOfMemoryException when calling mono_jit_init

Duane Wandless duane at wandless.net
Wed Nov 19 07:02:41 EST 2008


Hard for me to tell what is going wrong... I do embed mono 2.0.1 from within
my Cocoa app.  Make sure you are compiling with the correct flags.
http://www.mono-project.com/Embedding_Mono  check pkg-config.  From within
the main.m I call:

    NSString *libraryPath = [[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@"Contents/Libraries"];
    NSString *sampleAssemblyPath = [libraryPath
stringByAppendingPathComponent:@"MacMonoClient.exe"];
    NSLog(@"libraryPath: %@", sampleAssemblyPath);

    mono_config_parse ("config");
    domain = mono_jit_init ([sampleAssemblyPath UTF8String]);
    MonoAssembly *monoAssembly = mono_domain_assembly_open(domain,
[sampleAssemblyPath UTF8String]);

    NSLog(@"sample assembly: %p", monoAssembly);
    mono_jit_exec (domain, monoAssembly, 1, argv);

Where sampleAssemblyPath points to the full path name to my mono EXE.  And I
currently use mobjc/mcocoa.

Best of luck,
Duane

On Wed, Nov 19, 2008 at 5:47 AM, silver83 <silver83 at gmail.com> wrote:

>
> I'm having some problems with embedding mono into my cocoa app.
> note : please no "use monobjc" or "use cocoa#" comments.
>
> Result of the following code :
>
>    mono_trace_set_level_string("debug");
>    mono_jit_set_trace_options("");
>    domain = mono_jit_init ([assemblyPath UTF8String]);
>
> Is this (Note the OutOfMemoryException). :
>
> Mono-INFO: Assembly Loader loaded assembly from location:
>
> '/Library/Frameworks/Mono.framework/Versions/2.0.1/lib/mono/2.0/mscorlib.dll'.
> Mono-INFO: Config attempting to parse:
>
> '/Library/Frameworks/Mono.framework/Versions/2.0.1/lib/mono/2.0/mscorlib.dll.config'.
> Mono-INFO: Config attempting to parse:
>
> '/Library/Frameworks/Mono.framework/Versions/2.0.1/etc/mono/assemblies/mscorlib/mscorlib.config'.
> Mono-INFO: Config attempting to parse:
> '/Users/yoni/.mono/assemblies/mscorlib/mscorlib.config'.
> ENTER: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)([System.OutOfMemoryException:0x1bdfc0],
> 0xbffff634, 0x0, 0x930e8, )
> . ENTER: System.OutOfMemoryException:.ctor
> (string)(this:0x1bdfc0[System.OutOfMemoryException Client.exe],
> [STRING:0x1bcfc8:Out of memory], )
> . . ENTER: System.SystemException:.ctor
> (string)(this:0x1bdfc0[System.OutOfMemoryException Client.exe],
> [STRING:0x1bcfc8:Out of memory], )
> . . . ENTER: System.Exception:.ctor
> (string)(this:0x1bdfc0[System.OutOfMemoryException Client.exe],
> [STRING:0x1bcfc8:Out of memory], )
> . . . LEAVE: System.Exception:.ctor (string)
> . . LEAVE: System.SystemException:.ctor (string)
> . LEAVE: System.OutOfMemoryException:.ctor (string)
> LEAVE: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)[OBJECT:0x0]
> ENTER: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)([System.NullReferenceException:0x1bdf88],
> 0xbffff634, 0x0, 0x931d8, )
> . ENTER: System.NullReferenceException:.ctor
> (string)(this:0x1bdf88[System.NullReferenceException Client.exe],
> [STRING:0x1bfed8:A null value was found where an object instance was
> required], )
> . . ENTER: System.SystemException:.ctor
> (string)(this:0x1bdf88[System.NullReferenceException Client.exe],
> [STRING:0x1bfed8:A null value was found where an object instance was
> required], )
> . . . ENTER: System.Exception:.ctor
> (string)(this:0x1bdf88[System.NullReferenceException Client.exe],
> [STRING:0x1bfed8:A null value was found where an object instance was
> required], )
> . . . LEAVE: System.Exception:.ctor (string)
> . . LEAVE: System.SystemException:.ctor (string)
> . LEAVE: System.NullReferenceException:.ctor (string)
> LEAVE: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)[OBJECT:0x0]
> ENTER: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)([System.StackOverflowException:0x1bdf50],
> 0xbffff634, 0x0, 0x93220, )
> . ENTER: System.StackOverflowException:.ctor
> (string)(this:0x1bdf50[System.StackOverflowException Client.exe],
> [STRING:0x1c0f50:The requested operation caused a stack overflow.], )
> . . ENTER: System.SystemException:.ctor
> (string)(this:0x1bdf50[System.StackOverflowException Client.exe],
> [STRING:0x1c0f50:The requested operation caused a stack overflow.], )
> . . . ENTER: System.Exception:.ctor
> (string)(this:0x1bdf50[System.StackOverflowException Client.exe],
> [STRING:0x1c0f50:The requested operation caused a stack overflow.], )
> . . . LEAVE: System.Exception:.ctor (string)
> . . LEAVE: System.SystemException:.ctor (string)
> . LEAVE: System.StackOverflowException:.ctor (string)
> LEAVE: (wrapper runtime-invoke)
> System.Object:runtime_invoke_void__this___string
> (object,intptr,intptr,intptr)[OBJECT:0x0]
> Mono-INFO: Assembly mscorlib 0xf148a0 added to domain Client.exe,
> ref_count=1
>
>
> --
> View this message in context:
> http://www.nabble.com/OutOfMemoryException-when-calling-mono_jit_init-tp20577343p20577343.html
> Sent from the Mono - OSX mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20081119/c6e8bec4/attachment.html 


More information about the Mono-osx mailing list