Changes between Initial Version and Version 16 of Ticket #4191
- Timestamp:
- Oct 1, 2016, 4:00:22 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #4191
- Property Status new → closed
- Property Keywords review removed
- Property Resolution → fixed
-
Ticket #4191 – Description
initial v16 1 1 The underlying issue for the memory crash everybody experiences is the update of the passability map for the AI. 2 3 2 It uses our custom `ToJSVal` for `Grid`s which does the following: 4 3 * Create a new array … … 6 5 * Set the `data` property of `m_PassabilityMapVal` to the new array 7 6 * (Later the old value of `data` will be deleted by the GC since it is not used anymore) 8 9 7 Thus, 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 11 8 This 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 13 9 Additionally, 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 15 10 This fixes the memory crash I experience in large maps (like Stan's new Corinthian Isthmus(4)), but other people should also test it.