-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
pygame.display.set_mode runs out of memory #331
Comments
I started looking into disabling the camera initialization. I found that the camera code was not included in the build (see the Setup file) so it must be something else. |
Looked into the problem some more. I call pygame.display.Info before that and it works correctly. |
Touchtracer works, but pygame is used as a base for our Window provider / touch event. Memory error on a set_mode can just highlight some issue with your code prior the Window initialization? Maybe you could share your app source code or a reproducible snippet? |
Thanks for the reply. Here is a test case. For some reason the indentations are not shown unless the post is in edit mode.
The size of the window doesn't seem to matter. It runs out of memory also for 1280x720 which is the native resolution of the device. Here is the logcat from my phone. It's a Samsung Galaxy S5 mini with Android version 4.4.2:
|
This is the logcat I got from a Nexus 4 simulator. It didn't get as far as the phone did to print the info variable in the test case.I/ActivityManager( 521): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test/org.renpy.android.PythonActivity} from pid 622 |
I wonder if it has something to do with a p4a build error I noticed - there was a message that the compiler could not find the jnius.c file and then the build took a couple of secconds on the next line and it was compiling that file following that. It seemed awkward as if the build was trying to find the file here and there until it succeeded. |
Looked some more into this. It's coming from src/jni/src/video/SDL_SetVideoMode.c |
I got myself unblocked by copying the sdl libraries from pgs4a-0.9.6 into the dist/default/libs/armeabi directory. |
Now i understand. We don't aim to let you use the pygame directly, maybe that's why. The java part initialize GL, and require pygame/SDL to initialize it too. We don't provide pygame-based app directly, but that's what pgs4a provide. If you have been able to make your own changes upon that, that's good, but we don't provide it yet :) |
I'm able to build python-for-android and the touchtracer demo works fine for me.
However, when I try an application that uses pygame, I get an "Out of memory error" in the logcat upon the pygame.display.set_mode statement to set the screen resolution which is close to the beginning of the program after the pygame.init statement. I don't have this problem with the pygame subset for android (PGS4a-0.9.6) and when running python/pygame on Windows or RaspberryPi.
I need to build python-for-android myself in order to include the openssl package which PGS4A does not include.
I tried various things - NDK 8c, 9, 10d, Android API levels 14, 20, JDK 1.8.0, cython 0.20 with no success. I built on a debian x86 machine updated to the latest stable level.
I get the same problem whether I specify openssl, pil, and kivy modules as in the README.txt file or android, pygame, and pyjnius modules to build.
I tried tracing that out-of-memory message and if I'm not incorrect, it's coming from one of the camera C files in pygame where it tries to calloc a buffer during some initialization. I don't need camera support and I intend to comment out the camera initialization to see if it will get any further.
Any help will be greatly appreciated.
The text was updated successfully, but these errors were encountered: