Android aysnc_load ds_map

Discussion in 'Game Design, Development And Publishing' started by blitzbasement, Jul 6, 2019.

  1. blitzbasement

    blitzbasement Member

    Joined:
    Jun 27, 2016
    Posts:
    27
    I am using the android export module. The game works ok. No errors. Now I am adding in AdMob using test ads. I am also using the asynchronous-social event to detect triggering.
    I would like to know, would the ds_map that is automatically created by asynch_load be automatically destroyed if I used game_restart().
    Appreciate any help on this subject.Thanks.
     
  2. Justice

    Justice Member

    Joined:
    May 8, 2017
    Posts:
    471
    No, it won't be destroyed.
     
  3. blitzbasement

    blitzbasement Member

    Joined:
    Jun 27, 2016
    Posts:
    27
    I tried to destroy the ds_map as follows, in an alarm[1] event.
    ds_map_destroy(async_load);
    game_restart();

    and I got the following error,
    : ERROR in
    action number 1
    of Alarm Event for alarm 1 for object oNewGame:
    Data structure with index does not exist.
    at gml_Object_oNewGame_Alarm_1

    The manual says the following about async_load,
    This variable is global in scope and is used to hold a DS map when used in the Asynchronous Events, and -1 at all other times. The actual contents of the DS map will depend on the type of asynchronous event that it is populated in, and the function that was used to trigger the event, so refer to the individual pages for those events.

    So I am wondering if this map can be destroyed or am I doing it the wrong way. Any suggestions, please.
     
  4. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,164
    By the time an Alarm 1 event rolls around later, the map would have been gone already, so you don't need to destroy it. The Alarm 1 event counts as "all other times", so you're getting an error because you're trying to clean up map -1 (which never exists).
     
  5. blitzbasement

    blitzbasement Member

    Joined:
    Jun 27, 2016
    Posts:
    27
    Thanks Frosty. I was concerned about memory leaks from this particular ds_map.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice