Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Not enough memory to create texture #30

Open
StLouisCPhT opened this issue Mar 27, 2024 · 21 comments
Open

Error: Not enough memory to create texture #30

StLouisCPhT opened this issue Mar 27, 2024 · 21 comments

Comments

@StLouisCPhT
Copy link

StLouisCPhT commented Mar 27, 2024

Granted, this is probably an edge case regarding the triggering of the error. But it is one that I have noticed and reproduced several times and could be indicative of an issue elsewhere as well.

If you load approximately 25 games in a row without closing Mame4Droid 2024, the main menu will begin to show graphical issues such as random artifacts and incorrect resolutions as well as begin to load slower. Eventually, after about 40 games you will trigger the error message: "Not enough memory to create texture" and the screen will go black, forcing you to return to the home screen and close the mame4droid app.

You do not have to actually play the games, just loading them and then quitting and loading a new game is sufficient. Most of the games I prefer to play are from the '70s and '80s, but presumably newer games would also trigger the issue and potentially even faster as they would require more resources to even just start the games. While I encountered the issue on a Shield TV, it is probable that this issue would occur on other Android TV devices as well

2019 Shield TV Pro
nVidia Software 9.1.1 / Android 11
Not running any other apps in the background (other than whatever is used by the OS without user interaction)
Games are installed on an external Sabrent enclosure containing a Samsung 970 nvme drive (also tested using the Shield's internal emmc memory)

PXL_20240327_232217093
PXL_20240327_232241554
PXL_20240327_232329291
PXL_20240327_232332953

@seleuco
Copy link
Owner

seleuco commented Mar 28, 2024

Wow. That is a very interesting issue ;)

The error occurs basically because the GPU is running out of memory. It’s seems that is not freeing the gpu memory :?

It could even be an error in the OpenGL ES driver. I have tested many more than 25 games on my phone that has an Adreno GPU and that error definitely does not happen.

When I tested on the shield, that Tegra GPU was a headache because the shaders didn't work well and I had many incompatibilities with the shader language…

What rendering engine are you using in MAME4droid settings? OpenGL ES 3.2 with shaders or OpenGL ES 1.1 (the good old no shader’s one )...

I suspect that you are having some shader problem. Are you using a specific shader? If you use another shader or better none, do you have that problem?

Google is quite annoying with application updates on Android TV. They rejected my last update with strange anrguments and I had to make appeal to get the update approved. I suspect that in a ridiculous way they want that platform to have a better reputation and they put a lot of problems in those applications that they do not understand like an emulator which you have to put roms on it to get it working… :))

Another question… How many ROMs have you?

Because of security restrictions of scoped storage, the ROMs have to be cached at the start of the application and that consumes a lot of memory and the shield is already old and has very little ram memory for today's standards. It is possible that you have many roms in your nvme and the shield is very tight on memory and you get that error because you literally do not have enough memory to cache so many roms. could this be the problem?

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 28, 2024

OpenGL ES 1.1

Default resolutions for both emulation and front end

Absolutely no shaders

I'm not interested in bells and whistles, so things like shaders, retroachievements and overwhelming quantities of preferences get ignored by me (Retroarch is on my 'avoid unless there is no choice' list due to the sheer number of preferences). I start an emulator, select the game I want and begin playing.

(I stopped using artwork until I finish my entertainment room and get a 65" or larger TV so I don't have to compromise between cropped artwork or a mini game "display".)

I have the full MAME (split) set of over 40,000 games but even a micro set of less than 25 games has the same issue if they are started and quit in the manner I described.

I should point out that I am notorious for pushing the limits of my devices. I have (intentionally) run both of the remade Star Wars Battlefront games on Surface Pro Tablets as far back as the Pro 4 and put my (at the time) newly released M1 Macbook Pro to the test answering the gamers' question of "Can it run Crisis" by successfully playing the original windows version using the intel version of Crossover with all settings maxed out to prove the value of the new chip to my coworkers (and to some of the Dolphin team when Deleoth was not interested in supporting it).

@seleuco
Copy link
Owner

seleuco commented Mar 28, 2024

I have a full split MAME set of over 40,000 games but even a micro set of less than 25 games has the same issue if they are started and quit in the manner I described.

From what I have seen in the photos that you have attached, that microset is really a filter…

The important thing is that when you start mame4droid it points to a directory with 40,000 files even though you only see 25...

Is that correct? Are you configuring the directory with the complete romset in mame4droid?

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 28, 2024

I've done it both ways, full set on the external drive and a custom made set of 25 games on the internal storage.

The micro set was just made as a test and I didn't keep it. Rather than recreating it and changing locations today, It was quicker to use the favorites filter I made of classic games I grew up with.

Like I said, this is an edge case issue. Most people probably won't do what I was doing. The only reason I even was starting and stopping so many games was to find a specific one I played in the 80s and couldn't recall the name.... Since so many games at that time were copycats of others, I needed a quick way to find it.

@seleuco
Copy link
Owner

seleuco commented Mar 28, 2024

okay. then the problem must lie elsewhere.

In any case, it seems incredible to me that it works on devices as old as the shield with so little memory.

The library build when compiling the full set of Mame exceeds several hundred megabytes uncompressed. It is a real madness that should put devices with little RAM to the limit. That's why I limited this version to modern devices and a modern SDK as well. The only exception is the shield because I have one and I love it because Nvidia gave it to me time ago so I could develop with it.

In any case, I'll give it a try to see if I can think of anything, but it's difficult if it works correctly on the rest of the devices I have. :(

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 28, 2024

It could be that even though I got mine in November of last year, it might be a hardware defect occuring. I'm planning on getting another one soon to replace my Series X as a video player in a different room but I am waiting for them to go on sale again.

I suppose I could replace the ram with larger ones..... But that would require me to be extremely bored.

I should ask, which model is yours? It could be caused by some "minor" difference between X1 and X1+ chip sets.

Unlike most Shield owners, I don't think we will see a new version released. Even if Nintendo does release a new Switch model there isn't any guarantee that it'll be a nVidia based system this time, and even if it is that doesn't mean that nVidia will bother making anything else for home use.

@seleuco
Copy link
Owner

seleuco commented Mar 28, 2024

No. I think is a problem with all shield devices probably related to a gpu driver bug or particularities and that this mame is very demanding in terms of memory and hardware. Not a problem with your shield.

As I mentioned before, I have already seen other types of problems with the shield and this version of Mame wiphen I tested shaders.

When I said that it didn't fail to me with my other devices, I wasn't referring to the shield. I'm sure (and I'll try it when I have a some time) that the problem you mentioned happens to me too because, as you say, I haven't launched more than 25 roms in a row on the shield, but on the phone.

@seleuco
Copy link
Owner

seleuco commented Mar 28, 2024

Could you try enabling the opengl es 3.2 rendering. It’s using not power of two textures. You don’t need to enable any shader. I would like to know if fails with the same number of ROMs in a row.

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 28, 2024

Okay, here is where I am at.

  1. Using OpenGL ES 3.2, the full set still has memory issues. Took longer to get the glitches to start (about 45 games) but it is quicker to outright fail (about 3 more games later). When it does fail, the game that was being run remains on screen with the error message overlaid before switching to the blank/black screen

  2. Using OpenGL ES 3.2, a microset of approximately 50 games has no issues - even after going through the list twice for an approximation of 100 games.

  3. I never thought to pay attention before but now that I am doing so, I do not notice any appreciable difference in the time it takes to cache 50 games vs 40,000+ games

  4. Compared to an emulator like Dolphin, I don't find M4D 2024 to be as demanding on memory or hardware. In fact when comparing 1.10.3 to 1.9.6, the performance has increased a great deal. I was honestly surprised at it. Mortal Kombat 4 is a good example of this. It used to visually stutter a lot. But in the latest version it is smoother and enjoyable without using speed hacks. The only real issue is that I never know if it is going to run properly or if it is going to crash immediately after Raiden says "banish Shinnok" during the opening fmv (only happens with M4D 2024) as well as how long it will keep running or how long it will keep crashing at that exact spot. Of course, I do acknowledge that games that use chds could perform worse as they are more complicated and advanced games, but I don't have any of those, so it is a non issue for me.

@seleuco
Copy link
Owner

seleuco commented Mar 31, 2024

Hi.

I have been testing it extensively with my shield and I have not been able to get it to fail. It's super strange because when something fails it's for something.

As I already told you at the time, this application consumes a lot of memory as it reads many files in memory because I create a virtual file system instead of managing file URLs as other emulators can do for different technical reasons. That is why it takes longer to boot and consumes more memory the more ROMs you have.

It is very strange that it takes you the same time to read 50 as 40,000 files since SAF is very slow. Someone is in the middle is caching so many files and that may be why you have less available memory.

When the application runs out of memory is when the things you mention happen.

OpenGL ES 3.2 may alleviate the problem somewhat because it uses less memory than 1.1.

That occurs to me is that for some reason that I don't fully understand, you have less memory available and there is probably some memory leak in some pattern that you make and I don't.

The first thing I thought was that we were not using the same version but that does not seem to be the case. :??

I have tested it with a default installation without configuring anything and only pointing to my test romset of 3900 files.

@seleuco
Copy link
Owner

seleuco commented Mar 31, 2024

I have inspected app's memory usage a with Memory Profiler and i dont see any important memory leak :(

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 31, 2024

I think it might have something to do with file or folder location. Like I said earlier, I don't just keep my games on the external drive - I also keep samples, cfg, nvram and UI there to reduce the possibility of data loss due to a crash corrupting things or forgetting to backup before uninstalling. For mame to see them, I set their locations as follows:

  1. /storage/{drive name}/games/mame/roms
  2. /storage/{drive name}/games/mame/samples
  3. /storage/{drive name}/games/mame/cfg
  4. /storage/{drive name}/games/mame/nvram
  5. /storage/{drive name}/games/mame/ui

I have noticed with this setup I see .cfg files, my favorites file and even samples zips displayed as being cached even though they are not in the game directory. Could that be part of the issue?

I won't be able to do it today due to the holiday, but I can try testing loading multiple games consecutively using the default installation and see what happens.

@seleuco
Copy link
Owner

seleuco commented Mar 31, 2024

could be. It is definitely not a configuration that many people use and by caching all the files more memory is used and it must be somewhat tight in the shield….

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Mar 31, 2024

What is interesting is that on an unmodified default setup, if you look in mame game settings at the folders section, it will list the artwork, samples and software folders as being located in the folder chosen for the game location as well as ./{folder name}. I could understand them being cached in that setup.

@seleuco
Copy link
Owner

seleuco commented Mar 31, 2024

That's something I did on purpose. Apart from the default mame artworks directory, I add one hanging from the ROMs directory that the user configures in the external storage (not the internal ROMs folder) That way a user can put artworks in the external storage directory without having to access the internal data directory, which is very difficult to access without a PC.

In any case, I think that most people should not put in a complete full set. Maybe in the shield it may make a little more sense but it pi’s a little dated

@StLouisCPhT
Copy link
Author

I'll still test with the default (tomorrow probably) and let you know what happens.

There is also another Android TV device I'm tempted to get and try that has a lot more recent specs. I'm just not convinced the CPU/GPU are better than the shields; definitely a lot more ram and storage space though.

@StLouisCPhT
Copy link
Author

Okay.... Now this is different.

I just tried start/stopping games, running off a clean install with only the folders I keep my roms in configured and filled. Caching went a lot faster than it did in the past, and I couldn't crash the app (at least not in the quick 50 games I tried.

@seleuco
Copy link
Owner

seleuco commented Apr 2, 2024

Thanks for the tests. There are definitely so many possible combinations and in an application as large as this the casuistics of each one are difficult to cover.

The other day a person contacted me who had a latest generation Samsung and he did not see the data files but he did see them on the rest of the devices he has. However, they were there because he downloaded the images and everything worked correctly.

The first thing I thought was that Samsung wants to be the Apple of Android and its ecosystem is very invasive and knowing what Samsung had done with the access haha

I still have no idea what is happening to Samsung phones.

@StLouisCPhT
Copy link
Author

I am a former Samsung repair technician from the company uBreakiFix by Asurion and I can tell you that yes, Samsung is darn well determined to be the apple of the Android world.

Unfortunately I don't have an Samsung device in my possession (I found their software to be way too problematic to ever want to deal with it as a consumer) but I will think on the situation as well as talk to some of my former co-workers and see if we might be able to figure out what's going on. Did they mention which model Samsung they had?

@StLouisCPhT
Copy link
Author

I'm going to test the ROMs again tonight with your .264 build. I don't expect there to be any changes, but it doesn't hurt to try and see.

@StLouisCPhT
Copy link
Author

StLouisCPhT commented Jun 24, 2024

Well, problem still exists - but I figured that since you didn't mention any changes in that regard ;)

It does seem to do better when using a shield and a replacement launcher like Projectivy. I've only done some quick tests though, nothing serious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants