GameMonkey Script

GameMonkey on Marmalade SDK
Page 1 of 1

Author:  Downsider [ Tue Oct 18, 2011 5:45 pm ]
Post subject:  GameMonkey on Marmalade SDK

Hi. I've been using GameMonkey with the Marmalade SDK for a while now. I've recently encountered a problem, however. Whenever I try to pass a table from C++ into GameMonkey, I get a memory leak, however, I do not get a leak if I pass a usertype or built-in type. In addition to this, the garbage collector never actually seems to run, even though I've never disabled it. I'm unsure if this is related to the Marmalade SDK or not, but it's a huge hurdle that I haven't been able to get over.

The function could even be reduced to simply:
and the leak would still occur. Any ideas? Did I misconfigure something..?

Author:  Greg [ Wed Oct 19, 2011 1:12 am ]
Post subject:  Re: GameMonkey on Marmalade SDK

Welcome to the forum Downsider :)
I think we'll need some more information to help. What kind of memory leak are you seeing? What is the exact error message, or if debug info is present, where does output say the leak coming from? What platform and compiler are you using? Why do you think the garbage collector doesn't run? Have to queried GC stats, added break point, reduced memory limit or such? You are trying to pass a table from C++ to GM, where is this done? From within a native bound function to be called from GM? Can you paste some sample code with surrounding context? I have no knowledge of the Marmalade SDK to comment on integration with it.

Author:  39ster [ Sat Oct 29, 2011 12:24 am ]
Post subject:  Re: GameMonkey on Marmalade SDK

I've talked to downsider about this and i think the issue was not calling gmMachine::execute() (which will call the garbage collector). He is creating and executing threads using the gmCall lib but never calling gmMachine::execute().

So yeah, it's not a bug with GM :)...although this might be confusing for newer users. gmMachine::execute() must be called, to both collect the garbage and to continue the execution of yielded threads.

Author:  Greg [ Sun Oct 30, 2011 3:56 am ]
Post subject:  Re: GameMonkey on Marmalade SDK

Thanks for the update 39ster. In hind sight I would have designed GM to allow individual threads to be pumped, however the current implementation does not intend that. The minimal examples show correct usage, though I can understand how there could be confusion about executing individual threads like some other scripts do, or simply omitting the per frame/cycle update.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group