[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Cocoa (ObjC) in Lua modules
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Mon, 14 Jan 2008 02:41:28 -0800
On Jan 13, 2008 11:22 PM, Asko Kauppi <firstname.lastname@example.org> wrote:
> You maybe need to be more precise; exactly which error messages do
> you get?
Here's a backtrace
GuardMalloc[LuaAV-29575]: Tried to free pointer at 0x15a8f860 which is
not currently a pointer to a malloc buffer.
GuardMalloc[LuaAV-29575]: Explicitly trapping into debugger!!!
Program received signal: "SIGTRAP".
#0 0x9b873085 in GMfree ()
#1 0x90a5b8cc in _free_internal ()
#2 0x90a6255f in unmap_images ()
#3 0x90a59368 in _objc_notify_images ()
#4 0x8fe0e31a in
#5 0x8fe029af in __dyld__ZN4dyld11removeImageEP11ImageLoader ()
#6 0x8fe07a99 in __dyld_NSUnLinkModule ()
#7 0x900510c4 in NSUnLinkModule ()
#8 0x00035d85 in gctm ()
#9 0x00030dd8 in luaD_precall ()
#10 0x00030e78 in luaD_call ()
#11 0x00032664 in GCTM ()
#12 0x0003268e in luaC_callGCTM ()
#13 0x000304f2 in luaD_rawrunprotected ()
#14 0x0003ab16 in lua_close ()
#15 0x0000481a in LuaAV::close_Lua (this=0x6180)
#16 0x00004880 in close_lua () at
#17 0x00002a2d in -[LuaAVResponder applicationWillTerminate:]
(self=0xb8178ff4, _cmd=0x5064, aNotification=0xe8b8efec)
#18 0x927f015b in _nsnote_callback ()
#19 0x908563ca in __CFXNotificationPost ()
#20 0x9084db69 in _CFXNotificationPostNotification ()
#21 0x927e8704 in -[NSNotificationCenter
#22 0x927ef6a9 in -[NSNotificationCenter postNotificationName:object:] ()
#23 0x93423140 in -[NSApplication terminate:] ()
#24 0x93389dbc in -[NSApplication sendAction:to:from:] ()
#25 0x93437d0f in -[NSMenu performActionForItemAtIndex:] ()
#26 0x93437a51 in -[NSCarbonMenuImpl
#27 0x934376a8 in -[NSMenu performKeyEquivalent:] ()
#28 0x93437149 in -[NSApplication _handleKeyEquivalent:] ()
#29 0x9336adbb in -[NSApplication sendEvent:] ()
#30 0x93295e1e in -[NSApplication run] ()
#31 0x93289d4f in NSApplicationMain ()
#32 0x0000257e in main (argc=1, argv=0xbffff818)
> One thing I know is if there's multiple Lua core instances in use
> (i.e. 'lua' executable has the core statically compiled, and 'liblua'
> has it also, used by modules) this will cause problems on OS X
> _only_, and the problems will be complaints about malloc/free usage,
> which is ..hmm.. misleading. Apart from OS X, one also needs to be
> using multiple Lua states to get into this problem. The solution is
> simple; to make Lua executable link to liblua; fink distro does this
> since >= 5.1.1-14.
I'm using Lua in 2 entirely separate places but both link again a
Lua.framework. One is embedded within a C++ class and never loads any
modules. The other is embedded in the App and does all the module
> Another issue is prefering to use 'dlopen()' and not 'NSLoadModule
> ()', as discussed on the list way back. In other words,
> LUA_USE_DLOPEN, LUA_USE_POSIX instead of LUA_USE_MACOSX. Also this
> will require one to do multithreading and Lua to actually matter.
Thanks for this tip. I'll look into it.