GameMonkey Script

GameMonkey Script Forums
It is currently Wed Nov 14, 2018 12:08 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Oct 18, 2011 5:45 pm 
Offline

Joined: Sun Oct 16, 2011 7:24 pm
Posts: 7
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:
machine->PushNewTable();
and the leak would still occur. Any ideas? Did I misconfigure something..?


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 19, 2011 1:12 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 707
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.


Top
 Profile  
Reply with quote  
PostPosted: Sat Oct 29, 2011 12:24 am 
Offline

Joined: Sat Apr 25, 2009 1:40 am
Posts: 66
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.


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 30, 2011 3:56 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 707
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group