Elvas Tower: memory using monogame or - Elvas Tower

Jump to content

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

memory using monogame or Rate Topic: -----

#1 User is offline   alteo80 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 82
  • Joined: 07-January 18
  • Gender:Male
  • Location:Paris 13 (France)
  • Simulator:open rails ny
  • Country:

Posted 05 November 2021 - 10:09 AM

hello, I regularly use your version of openrail, today, during an activity loaded with traffic and static equipment, on a French road at the lge v4, I noticed that the video memory is not discharged, and at the end of the activity which lasts 30 min, I reached 7190 mo of use of the video memory. letting the game continue the occupation of the memory continues to increase slowly. the graphics card has 8 gb of ram embeded and the system 16 gb ... tests carried out only on the latest version 108.2. thanks

#2 User is offline   engmod 

  • Open Rails Developer
  • PipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 2,164
  • Joined: 26-February 08
  • Gender:Male
  • Location:Eltham, Victoria, Australia
  • Simulator:ORNYMG
  • Country:

Posted 05 November 2021 - 07:12 PM

Hi Alte,

I have just tested RMD_west and tested with GPUz and I find that GPUz reports "system memory used" rather than graphics card memory used.
I also used the extended HUD in 108.2 to see what memory usage it reports, but I unsure what memory it reports.

How are you measuring memory used?

#3 User is offline   alteo80 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 82
  • Joined: 07-January 18
  • Gender:Male
  • Location:Paris 13 (France)
  • Simulator:open rails ny
  • Country:

Posted 06 November 2021 - 03:32 PM

View Postengmod, on 05 November 2021 - 07:12 PM, said:

Hi Alte,

I have just tested RMD_west and tested with GPUz and I find that GPUz reports "system memory used" rather than graphics card memory used.
I also used the extended HUD in 108.2 to see what memory usage it reports, but I unsure what memory it reports.

How are you measuring memory used?

hello, to measure, I use two soft, to be sure, msi afterburner and xtremetunerplus which is used by the manufacturer of my video card. the results are identical, it looks like a memory leak, it seems to me that it was reported in last April on this forum http://www.elvastowe...es-more-memory/ the more we advance in the versions the more the fps deteriorate ... a memory leak is also present ... am I really the only one?

#4 User is offline   engmod 

  • Open Rails Developer
  • PipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 2,164
  • Joined: 26-February 08
  • Gender:Male
  • Location:Eltham, Victoria, Australia
  • Simulator:ORNYMG
  • Country:

Posted 09 November 2021 - 12:35 AM

I have just run an activity from Mullan Pass.
Using the extended HUD and the last screen "debug"
I started with 420MB of gpu memory and ended 1.5 hours later with 1361MB of memory used.

Attached is the OR log and a screen shot at the end of the activity.

Attached File(s)



#5 User is offline   alteo80 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 82
  • Joined: 07-January 18
  • Gender:Male
  • Location:Paris 13 (France)
  • Simulator:open rails ny
  • Country:

Posted 09 November 2021 - 09:42 AM

View Postengmod, on 09 November 2021 - 12:35 AM, said:

I have just run an activity from Mullan Pass.
Using the extended HUD and the last screen "debug"
I started with 420MB of gpu memory and ended 1.5 hours later with 1361MB of memory used.

Attached is the OR log and a screen shot at the end of the activity.

hello, and thank you for your example, I have similar results, the American roads are generally much lighter than the European roads, and load less the video memory, the traffic too ... but the observation is there, the game does not restore no memory, it is very clear, memory leak, thank you for the interest in the subject.

#6 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,450
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 11 November 2021 - 12:02 AM

I have performed some tests yesterday. First I compared the official OR testing version (which is 32 bit) with ORNYMG with the 32 bit option checked. I got very similar results, and memory values growing at beginning, but then oscillating around a more or less stable value.
I then run ORNYMG at 64 bit, and saw memory growing much more. Memory usage is also higher at the beginning of the game.
I then introduced a garbage collection every two minutes, but nothing changed.
Strangely I noticed that, in two occasions, after starting another app while leaving OR in run state (no pause) and after few time moving again the OR window on the foreground, memory was lowered by some humdreds of MB!
At the moment I won't investigate further. I hope that in reasonable time 64 bit will be available also in the OR official version, and at that moment someone capable will solve this.
In the meantime I can only recommend what I recommended also some time ago: if there is no real need to go beyond the 4MB of RAM because the route or the activity is very heavy, it's better to run 32 bit. You use much less memory and probably also run faster.

#7 User is offline   alteo80 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 82
  • Joined: 07-January 18
  • Gender:Male
  • Location:Paris 13 (France)
  • Simulator:open rails ny
  • Country:

Posted 11 November 2021 - 06:56 AM

hello, and thank you for taking the time to watch and test carlo. we will wait with option 64 unchecked :). the problem is reported. Thank you all. AND GOOD RAIL :)

#8 User is offline   engmod 

  • Open Rails Developer
  • PipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 2,164
  • Joined: 26-February 08
  • Gender:Male
  • Location:Eltham, Victoria, Australia
  • Simulator:ORNYMG
  • Country:

Posted 12 November 2021 - 02:42 AM

I have a better one.

3052MB for a 7 hour run on the ruel sub

Attached File(s)



#9 User is offline   Serana 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 08 December 2021 - 02:11 PM

GPU memory is generally used by textures. Do you think this memory "leak" is due to textures remaining in VRAM?

On StackOverflow, I have read that textures loaded manually are not removed from VRAM automatically if we don't use the content manager of XNA/MonoGame.
We have to call the Dispose function manually and I don't think we are currently calling this function. (See https://stackoverflow.com/a/48777516)

Perhaps we should call this function from the Sweep function of the SharedTextureManager.

#10 User is offline   Serana 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 09 December 2021 - 01:34 AM

About the main RAM, I did a test session to see what's happening. My results are the following:
- For managed memory (the one that is monitored directly by the application and that is garbage collected): the quantity is more or less constant.
- For unmanaged memory, we have indeed a memory leak: at the start of the session, I had 600MB occupied (300MB managed). At the end, I had 1200MB occupied (300MB managed).

So, it seems that we have some parts of the code using unmanaged memory and we are not cleaning up the memory properly.

#11 User is offline   Eldorado.Railroad 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,021
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 09 December 2021 - 09:38 AM

Please try this:

Attached File  9 Square Game (Outline).jpg (19.47K)
Number of downloads: 2

Pay close attention to the numbering of the squares. The purpose of this experiment is to move the camera between various squares. The squares represent the tiles in OR. The coordinates of the tile are given in the extended F5 debug HUD.

First) When your camera view, be it inside an engine, etc is on tile #5, and STAYS on tile #5, and you have trains of different types (this means NO repeat shapes and textures) passing back and forth, OR does NOT dispose any items, be it in system or video memory. If you select CAMERA #8 in OR and travel to an adjacent tile from tile #5 (this means tiles # 1,2,3,4,6,7,8,9), OR used to dump a whole bunch of things from memory, especially train data, like shapes and textures. I doubt that terrain data (shapes and textures, etc) on that terrain, houses, fences, trees etc, would be dumped, especially if you have a viewing range way beyond 2000 meters. The saving grace is that often terrain data (shapes and textures, etc) is reused across many tiles, so they do not have to be reloaded, nor will they occupy MORE memory.

Second) When your camera view is with a camera that is traveling, eg:an engine, and you are in tile #5, things used to get dumped from system and video memory as soon as it moves to an adjacent tile (# 1,2,3,4,6,7,8,9).

I would suggest that as an experiment to limit your viewing range to 2000 meters at runtime. Then test the above scenarios, paying close attention to the F5 debug HUD. The fancy graphs at the bottom will show you when things are loaded and unloaded.

If nothing ever gets dumped it means that memory management is broken. But as indicated above there are two scenarios which would be proof. I believe that that the XNA version 1.3x has the expected behavior. I have not looked at more recent Monogame versions.

This is not a new issue. Some 10 years ago it was a struggle to get this problem to be recognized as such. Users that stress test (I include myself) bring this problem back to the surface when noticed. The availability of many GB of RAM memory and 64 bit executables cannot hide poor resource management. As shapes/textures become more numerous and detailed "unlimited" resources will evaporate. If you are using models built for MSTS, from 20 years ago, along with sparsely populated tiles, the Monogame version of OR will "hide" the lack of resource management and perform very well. This is however the end of 2021, and we might very well be forced to take a second look as to how resources are managed.


Hope this helps,
Steve

#12 User is offline   cjakeman 

  • Executive Vice President
  • PipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 3,031
  • Joined: 03-May 11
  • Gender:Male
  • Location:Peterborough, UK
  • Simulator:Open Rails
  • Country:

Posted 09 December 2021 - 10:51 AM

View PostSerana, on 09 December 2021 - 01:34 AM, said:

About the main RAM, I did a test session to see what's happening.

Well done, Cedric.

Was this 32-bit or 64-bit? Official OR or OR_NewYear_MG?

#13 User is offline   Serana 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 09 December 2021 - 12:01 PM

I am using the official version (so 32-bit).

#14 User is offline   alteo80 

  • Hostler
  • Group: Posts: Active Member
  • Posts: 82
  • Joined: 07-January 18
  • Gender:Male
  • Location:Paris 13 (France)
  • Simulator:open rails ny
  • Country:

Posted 09 December 2021 - 02:00 PM

View PostSerana, on 09 December 2021 - 12:01 PM, said:

I am using the official version (so 32-bit).

hello, finally we get there xd,

#15 User is offline   Serana 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 10 December 2021 - 12:14 PM

View PostSerana, on 08 December 2021 - 02:11 PM, said:

GPU memory is generally used by textures. Do you think this memory "leak" is due to textures remaining in VRAM?

On StackOverflow, I have read that textures loaded manually are not removed from VRAM automatically if we don't use the content manager of XNA/MonoGame.
We have to call the Dispose function manually and I don't think we are currently calling this function. (See https://stackoverflow.com/a/48777516)

Perhaps we should call this function from the Sweep function of the SharedTextureManager.


To continue about this subject: I tried to add the Dispose function in the Sweep function... and when I tested a 3D cab, textures were disappearing.
At first, I thought it was a bug and that I shouldn't use the Dispose function in this function... until I saw that textures were not marked in the 3D cab viewer...

OK, so I have to go through the different renderers in order to see if all textures are marked properly before sweeping.

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users