android - How much is too much memory allocation in NDK? -
NDK download page notes, "The best good candidates for NDK are self-contained, CPU-intensive campaigns that don 'A' allocate a lot of memory, such as signal processing, physics simulation, and so on."
I came from C background and used to use NDK was excited to work most of my OpenGL ES functions physics, animation of the meridian, etc. Related native functions ... I know I'm up a little running that I have the original code and I am wondering whether I could make the mistake. I have not had any problem in testing at this point, but I am curious if I have problems in the future. For example, I have defined the game structure (as seen in San-Anjelus example). I'm dynamically loading vertical information for objects (just what is needed for an active game area), so vertical, normal, textured coordinates, index and texture are a bit of memory allocation for graphic data ... just the name needed I take precautions about the allocation between the areas of the game.
Do I want to protect some caps in the size of the array or should I move forward to move forward?
Since applications using NDK should behave like those developing by using SDK , I think the best guidance for the use of the appropriate heap is the comment.
/ ** * Existing copy-device memory class return to current device * It gives you an idea that How hard is the memory limit on your system That's why you let the overall system do the best job. * The returned value is in megabytes; Baseline Android Memory Class * 16 (which is the Java Hepap range of those devices); Some memory devices with more memory can return 24 or more numbers. * / Public int getMemoryClass () {return staticGetMemoryClass (); } / ** @Hide * / static public int static gate memory class () {// literally in the brain - just take it from the configured / vm hep size, and assume that it is in megabyte and thus " M "ends with string vmHeapSize = SystemProperties.get (" Dalvik.vm.heapsize "," 16m "); Return integer Parascent (vmHeapSize.substring (0, vmHeapSize.length () - 1)); }
The code that sets the size of the pile for the Dual VM is in. And using the function, give an example to define a border for the pile allocation in the native code is.
Structio (Hepsize Opsby, "-XMX"); Properties_gate ("Dalvik. VM. Hepases", Hepsz's Opsf + 4, "16m"); // LOGI ("Size Size:% s", Hepesz Opsbuff); Opt.optionString = heapsizeOptsBuf; MOptions.add (optional); The default value of
16m
is potentially important because neither does I have two Android phones dalvik.vm.heapsize
default property Set by form