The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Antarctica on May 24, 2018, 02:31:06 PM

Title: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Antarctica on May 24, 2018, 02:31:06 PM
I generate map:
(https://i.imgur.com/YmjJsTr.png)

I click town hall:
(https://i.imgur.com/coBDM7O.png)
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Dwachs on May 24, 2018, 07:56:26 PM
This bug should be fixed in r8455.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Antarctica on May 25, 2018, 11:18:05 AM
It is still/again there in 8460. The error message does not occur, but the game closes nevertheless.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Dwachs on May 25, 2018, 02:32:57 PM
Can you be more specific? What do you do to crash the program? The city window works for me.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Antarctica on May 25, 2018, 03:43:59 PM
I have found that city windows of cities below a certain coordinate work, above it, crash, I think it's the magic number 16384.

x = 3900 works
x = 7700 works
x = 11600 works
x = 14800 works
x = 16800 crashes
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Dwachs on May 25, 2018, 04:35:35 PM
I cannot reproduce this with the current version. Do you really have a current nightly running?
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: DrSuperGood on May 25, 2018, 07:38:19 PM
How much RAM and what OS does your computer have? Out of Memory can be thrown if it really is out of memory.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Antarctica on May 25, 2018, 07:47:37 PM
My computer has 16 GB memory, of which Simutrans uses 71 MB (according to task manager) before closing unexpectedly.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Ters on May 25, 2018, 10:07:31 PM
If memory consumption goes from 71 MB instantly to crashing, then Simutrans must be attempting one very large memory allocation.

I have a hard time figuring out what the values for space in city_info_t::resize can be in practice, but if there is no space, it appears that the values for minimaps_size will become bad (negative).
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Antarctica on May 26, 2018, 04:28:47 AM
Fixed in r8461, maybe as a side effect of the fix of the other bug I reported the same day. ([r8460] Auto-names of stops with coordinate > 16384 (https://forum.simutrans.com/index.php/topic,18210.0.html))
That would explain why dwachs couldn't reproduce - he already had r8461 on his machine.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Ters on May 26, 2018, 08:50:05 AM
I missed the fact that the error message didn't happen after r8460. That makes it a different bug. Probably an access violation caused by the invalid coordinate calculation fixed in r8461.
Title: Re: [r8387] Map size 20480x32: OutOfMemory error when opening city window
Post by: Dwachs on May 26, 2018, 08:59:43 AM
Yes, there was indeed another bug, which was fixed in r8461: city->get_center() produced negative coordinates due to signed integer overflow: old code was (lo+ur)/2, changing this to lo/2 + ur/2 fixed it, as no overflow occurs anymore.