[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array question

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: Array question
  • Date: Fri, 28 Jul 2006 07:54:02 -0600

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