Re: Array question

its probably making a copy:

  public Object get1DJavaArray(Class wantType) {
    if (wantType == getElementType()) {
      if (indexCalc.fastIterator) return getStorage(); // already in order
      else return copyTo1DJavaArray(); // gotta copy
    }

its supposed to detect if it needs to copy (eg if the index has been 
reordered). if you are sure theres no reordering, and its making a copy anyway, 
ill have to see why that test is failing.

Jeff McWhirter wrote:

John,
I have an Array of type ArrayFloat$D3
I do a:
arr.get1DJavaArray(float.class);
to get the float[] array

When I do this I am getting extra memory allocation (the 481K bytes):
0    2         >calling get1DJavaArray Array.getElementType=float
16   481       <calling get1DJavaArray ms: 16


What gives? Shouldn't the storage of this array just be the float[] array?


-Jeff


  • 2006 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: