Changes between Initial Version and Version 16 of Ticket #4191


Ignore:
Timestamp:
Oct 1, 2016, 4:00:22 PM (8 years ago)
Author:
Itms
Comment:

r18797.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4191

    • Property Status newclosed
    • Property Keywords review removed
    • Property Resolutionfixed
  • Ticket #4191 – Description

    initial v16  
    11The underlying issue for the memory crash everybody experiences is the update of the passability map for the AI.
    2 
    32It uses our custom `ToJSVal` for `Grid`s which does the following:
    43* Create a new array
     
    65* Set the `data` property of `m_PassabilityMapVal` to the new array
    76* (Later the old value of `data` will be deleted by the GC since it is not used anymore)
    8 
    97Thus, in the specific case of the AI map, this is sub-optimal and causes the allocation of a large chunk of memory (the entire passability map, array of size `width*height*size(u16)`) for nothing.
    10 
    118This patch adds a custom function that modifies the already allocated passability data. It also uses that method for the territory map, which is allocated the same way but causes less problems since it is far smaller.
    12 
    139Additionally, I propose to remove the function `GetConnectivityGrid` which is not used by the AI and has the same flaw. If the AI needs such a grid in the future, it should work the same way as the passability and territory ones.
    14 
    1510This fixes the memory crash I experience in large maps (like Stan's new Corinthian Isthmus(4)), but other people should also test it.