<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Clément,<br>
      <br>
      Le 22/05/2018 à 11:12, Clément David a écrit :<br>
    </div>
    <blockquote cite="mid:1526980369.2237.20.camel@esi-group.com"
      type="cite">
      <pre wrap="">Hello Samuel,

After some diving into the ast/types source code and debugging session I got some information :

 --> disp(%t)
    // gdb resolved the value as a <types::ArrayOf<int>> where m_iSize = 1
    // (the size of the inner m_pRealData)
 --> disp([%t %f %t %f])
    // gdb resolved the value as a <types::ArrayOf<int>> where m_iSize = 4
    // (the size of the inner m_pRealData)

So in Scilab 6, there is 4 byte per boolean; to me a first thing to do before changing the current
implementation is to let `who()` return both the memory used (including the Scilab header) and the
memory used by the inner data storage.

Note: as discussed in this ML, the overhead per for Scilab datatype (not inner value) is 208 byte
per value, to me it is more important to reduce it first as it will impact all ArrayOf based
datatype.
</pre>
    </blockquote>
    <br>
    So, i understand that it is hard, or even impossible, or useless, to
    assess the<br>
    impact of a change in term of back-compatibility wrt existing
    datafiles.<br>
    <br>
    I understand also that the Scilab devs team has finally decided --
    at least as a first step -- <br>
    to retrieve the former who() behavior to get the memory, so
    including the Scilab header. <br>
    To me, it would be anyway better to drop the "word" unit (set of 8
    bytes) and to <br>
    return the memory preferably <i>in bytes</i>. Beyond the recovery
    of [x,mem]=who(..),<br>
    this would already be an improvement.<br>
    <br>
    As far as i understand it -- what's not sure --, i am not convinced
    by the last point, in terms of priority.<br>
    The main concern of the initial report is the better usage of the
    memory,<br>
    noticeably when doing operations on big arrays with big intermediate
    boolean arrays. <br>
    Some operations may fail because of insufficient intermediate
    memory.<br>
    Now, even if 1000 variables are simultaneously defined in the
    workspace <br>
    -- this never happens, but let's assume it is so --, <br>
    and that each one takes 208 bytes (really per value ?? i assume it
    is rather per container. Is it right?),<br>
    then this uses 208 kbytes, what's nothing.<br>
    Now, if a single boolean array is defined and used to process a
    whole 1000x1000x4 RGBA image,<br>
    it uses alone 16 MB instead of 4MB, that's >>> 208 kbytes.<br>
    Avoiding to waste these 12 MB was the main aim of my initial report.<br>
    <br>
    Please correct me if my calculations are wrong, with respect to this
    aim.<br>
    <br>
    Best regards<br>
    Samuel<br>
    <br>
  </body>
</html>