Skip to main content
Known Participant
February 26, 2007
Question

Cant get gc() to run

  • February 26, 2007
  • 19 replies
  • 1671 views
Hi guys i am trying to run application.gc on disconnect of all users.

quote:


application.onDisconnect = function(client){
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
if (application.clients.length < 1){
application.gc();
applications.shutdown()
}
}



gc never seems to trigger and if i run a trace it returns false.

Anyone
    This topic is closed to new replies. Start a new post to keep the conversation going.

    19 replies

    Inspiring
    February 26, 2007
    oh well why didn't you say so make the shared object non persistant then when the user disconnects write null to the shared object .....something like...SO.data.slot1 = null; heck you could even clear the shared object every few minutes sure they wouldn't be able to scroll back up and read after the text clears but at least you won't double write or you could just copy the text into a second remote shared object and use that to write to your database and after it writes to the database it clears its self thereby leaving the text chat history intact.
    Known Participant
    February 26, 2007
    right ok that makes sense.
    But it would seem that it is not clearing up the garbage.

    i have been building simple textchat with fms, i am sure you have seen the example files.
    When the last person leaves a room i then run amfphp to save history to mysql db.
    This is working fine but if a user re-enters the chatroom after leaving then there is still the previous chat history from the SSO and again when he leave this history is added to the db. so it is kind of a duplicate entry into the db.
    If i could run the gc() after the last user has left the chat room then when he/she re-enters there should be a clean sheet. This is not the case.

    I can still see the SSO in the FMS admin console.

    thanks for any help
    Inspiring
    February 26, 2007
    yeah its server side action script that runs the garbage collection and since its collecting and disposing of server garbage it has no data to return it just simply cleans up. what exactly are you trying to do?
    Known Participant
    February 26, 2007
    I did view the docs before posting.
    And as you can see from the helps docs it doesn't exactly give very much to go on
    Inspiring
    February 26, 2007
    oh yeah is forcing a garbage collection really necessary for your application to function correctly?
    Inspiring
    February 26, 2007
    ummm i think application.gc refers to the application that is running so if i were to say ......myapp.gc(); then garbage collection would take place on that application.