I'm writing a mixed 2D/3D game on Android and I'm not able to determine how much texture memory I can use. Is there any way to determine maximum texture memory in OpenGL ES?

I have my own texture cache and want to know the maximum threshold of texture memory. I'm making an approximate estimation using activityManager.getMemoryInfo(mi), but on some devices when I try to allocate texture (and many more are already in memory) the application crashes (EGL_BAD_ALLOC). When I set this threshold to a lower value, everything seems to be ok. Does anyone have any idea? Or eventually how to determine that the texture allocation was unsuccessful, instead of crashing.

Edit
Report