EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Problem with subArray - unnecessary memory allocation
From: Thomas Birke <[email protected]>
To: [email protected]
Date: Wed, 04 Feb 2009 11:42:55 +0100
Hi,

I just ran into a surprising behaviour of the subArray-record.

What I wanted to do:

   * Source is a waveform of 2048 shorts.
   * my subArray should slice out the last 4 values of the source-array
     (actually split the source-array into hundreds of sub-arrays)
     record(subArray,"slice") {
       field(INP,"hugeWaveform CPP NMS")
       field(FTVL,"SHORT")
       field(MALM,"4")
       field(NELM,"4")
       field(INDX,"2044")
     }
   * surprisingly, my subArray-record was crippled after processing and had
     INDX = 3, NORD = 1

Looking at the source-code I found the following in subArrayRecord.c:readValue(psa)
       if (psa->indx >= psa->malm)
       {
          psa->indx = psa->malm - 1;
       }

Since the INDX actually has nothing to do with the subArray-record itself, but is just an index into the referenced waveform (of unknown size), to me it makes no sense at all to limit INDX to MALM-1.

For me the only solution is to set MALM of my subArray to INDX+NELM which leads to hundreds of oversized and allocated arrays in my subArray-records. E.g. to slice out the last element of a waveform, I have to (statically!) allocate space for the whole source-waveform and then copy exactly one element.

I simply ask to drop these 4 lines of code from subArrayRecord.c - it shouldn't even break existing installations, and for my case I could reduce memory-consumption a lot.

Regards,
Thomas

--
Thomas Birke
Operation Controls

Elektronenspeicherring BESSY II
Albert-Einstein-Str. 15, 12489 Berlin
Fon +49 30 6392 4934
Fax +49 30 6392 4859


Helmholtz-Zentrum Berlin für Materialien und Energie GmbH Glienicker Straße 100, 14109 Berlin Vorsitzende des Aufsichtsrates: Dr. Beatrix Vierkorn-Rudolph Stellvertretende Vorsitzende: Dr. Jutta Koch-Unterseher Geschäftsführer: Prof. Dr. Anke Rita Pyzalla, Prof. Dr. Dr. h.c. Wolfgang Eberhardt, Dr. Ulrich Breuer Sitz der Gesellschaft: Berlin Handelsregister: AG Charlottenburg, 89 HRB 5583 Information: Durch die Fusion mit dem ehemaligen Hahn-Meitner-Institut (HMI) ist BESSY nun Teil des neuen Helmholtz-Zentrum Berlin für Materialien und Energie (HZB). By the merger with the former Hahn-Meitner-Institut (HMI), BESSY became part of the new Helmholtz-Zentrum Berlin für Materialien und Energie (HZB). Disclaimer automatically attached by the E-Mail Security Appliance mail0.bessy.de 02/04/09 at Helmholtz-Zentrum Berlin GmbH.


Replies:
Re: Problem with subArray - unnecessary memory allocation Thomas Birke

Navigate by Date:
Prev: RE: Changes to PCAS in 3.14 Jeff Hill
Next: Re: Problem with subArray - unnecessary memory allocation Thomas Birke
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Changes to PCAS in 3.14 Jeff Hill
Next: Re: Problem with subArray - unnecessary memory allocation Thomas Birke
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·