Duplicating array in C code
I have a piece of Java code that passes an array of floats to a C++ library and would like to be able to have the C++ code just access the data through a pointer rather than needing to duplicate the array in memory before accessing it.
Right now I am passing it in as a jfloatarray type and copying it over to a array of floats by doing the following in my C++ code.
Code :
//jfloatarray is declared as in
float *data;
data = new float[size];
env->GetFloatArrayRegion(in,0,size,data);
I am concerned with copying the array for two reasons, the first is that its very large and storing extra copies can run me out of ram quickly, and second it seems like it would be faster to just use it in place rather than having the overhead of duplicating it.
Thank you for the help.
Re: Duplicating array in C code