| Android SDL_RWFromFile ERROR |
|
gabomdq
|
I think the native code needs to return to the "Java side" to actually release the references, that's why you eventually run out. See here http://groups.google.com/group/android-ndk/browse_thread/thread/490e1ba73e3102b5
|
|||||||||||
|
|
||||||||||||
|
gabomdq
|
Also, now that I think about it, I seem to recall that this issue was solved...are you using the latest SDL2 from HG?
|
|||||||||||
|
|
||||||||||||
|
Alexandr
|
Thank you. I've already read it, but an error in the SDL can not fix yourself. While using a different way to work with the APK file, without the SDL.
The latest version of SDL behaves the same way. |
|||||||||||||||
|
|
||||||||||||||||
| Android |
|
Sam Lantinga
|
The Android file code is in here:src/core/android/SDL_android.cpp
From inspection, it looks to me like it's doing the right thing. Does the Java VM garbage collection need to kick in to actually close the file references? On Thu, Feb 9, 2012 at 9:52 AM, Alexandr wrote:
|
|||||||||||||
|
|
||||||||||||||
| Android |
|
Paulo Pinto
Guest
|
As long as the code is calling close() it should suffice.
On Sat, Feb 11, 2012 at 7:36 AM, Sam Lantinga wrote:
|
|||||||||||||||
|
|
||||||||||||||||
|
gabomdq
|
There's a mention to a related bug in that barren land that is the Android bug tracker. http://code.google.com/p/android/issues/detail?id=2123
It was closed in May 2009, but there's a comment stating that the issue was present as of March 2010...perhaps it is still there, or perhaps you are using an old NDK/Android version? |
|||||||||||
|
|
||||||||||||
|
gabomdq
|
I submitted a fix for this issue here: http://bugzilla.libsdl.org/show_bug.cgi?id=1417 Can you try it out?
|
|||||||||||
|
|
||||||||||||
|
Alexandr
|
Yes, kick it would be nice.
r7
I picked up a copy of the SDL library a couple of days ago, so:
In my file SDL_android.cpp has the following lines:
it is a bit like a place where you applied the patch |
|||||||||||||||||||||
|
|
||||||||||||||||||||||
| Android SDL_RWFromFile ERROR |
|
gabomdq
|
|
|||||||||||||
|
|
||||||||||||||
| Re: Android SDL_RWFromFile ERROR |
|
Alexandr
|
sorry, hurry) Yes, your patch has decided my issue. Thank you very much. Last question: what do these lines in a function of Android_JNI_FileClose ? |
|||||||||||||
|
|
||||||||||||||
| Android SDL_RWFromFile ERROR |
|
gabomdq
|
2012/2/11 Alexandr
There's a limit of "local references" for the native code of 512 entries. The FileClose function was leaking 1 reference per call, and FileOpen tries to reserve 16 references when it begins, so when you open the 497th file, it fails (as there's only 15 spaces left in the table). If you want to learn more search for Android JNI Local and Global references, there's quite a bit of docs online. -- Gabriel. |
|||||||||||||
|
|
||||||||||||||
| Android SDL_RWFromFile ERROR |
|
Sam Lantinga
|
Thanks to Gabriel and Tim's efforts, this bug is fixed:http://hg.libsdl.org/SDL/rev/1893d507ba42
Cheers! On Sat, Feb 11, 2012 at 5:27 PM, Gabriel Jacobo wrote:
|
|||||||||||||||
|
|
||||||||||||||||

