[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Non-aligned pointer errors on Mac OS X
- From: Scott Weeks <scott@...>
- Date: Wed, 16 Jan 2008 12:35:38 +1100
Hello,
I'm new here :-)
Anyway, I've been doing some development with Lua and OS X and have
noticed that when I use some C libraries I get the following error (or
something like it)
lua(8680) malloc: *** error for object 0x40fa4: Non-aligned pointer
being freed
*** set a breakpoint in malloc_error_break to debug
This has occured for me with the luasqlite3 library as well as with a
C module that I've been writing. It occurs for me when I create a new
table from within C.
Adding a lua_newtable(L) call or a luaL_newmetatable(L,"blah") call
will get me these errors and they stop when I comment them out.
Now, I am very much a novice when it comes to C and memory management
and am particularly baffled with things like pointer alignement,
etc... I fired up gdb and managed to get the following stack when I
ran my program with malloc_error_break set
Breakpoint 1, 0x94e9b9f1 in malloc_error_break ()
(gdb) where
#0 0x94e9b9f1 in malloc_error_break ()
#1 0x94e969df in szone_error ()
#2 0x94dbbb83 in szone_free ()
#3 0x94dbb9ed in free ()
#4 0x00015c94 in l_alloc ()
#5 0x0000c4fc in luaM_realloc_ ()
#6 0x00010a3b in luaH_free ()
#7 0x0000a71d in sweeplist ()
#8 0x0000ab4f in singlestep ()
#9 0x0000ae68 in luaC_step ()
#10 0x000140ea in luaV_execute ()
#11 0x00008e30 in luaD_call ()
#12 0x00004951 in f_call ()
#13 0x0000833b in luaD_rawrunprotected ()
#14 0x00009152 in luaD_pcall ()
#15 0x000049c5 in lua_pcall ()
#16 0x00016ffa in luaB_xpcall ()
#17 0x000089f3 in luaD_precall ()
#18 0x00013e9e in luaV_execute ()
#19 0x00008e30 in luaD_call ()
#20 0x00004951 in f_call ()
#21 0x0000833b in luaD_rawrunprotected ()
#22 0x00009152 in luaD_pcall ()
#23 0x000049c5 in lua_pcall ()
#24 0x00002833 in docall ()
#25 0x00003024 in pmain ()
#26 0x000089f3 in luaD_precall ()
#27 0x00008dd3 in luaD_call ()
#28 0x00004a90 in f_Ccall ()
#29 0x0000833b in luaD_rawrunprotected ()
#30 0x00009152 in luaD_pcall ()
#31 0x00004ae7 in lua_cpcall ()
#32 0x00003405 in main ()
I don't know if that's useful but it seems to be right around the
palce where lua is reallocating memory... Any pointers would be
greatly appreciated.
Cheers,
Scotty Weeks