octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #55810] sizeof() returns 0 for classdef object


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #55810] sizeof() returns 0 for classdef objects
Date: Sun, 3 Mar 2019 16:44:33 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36

Update of bug #55810 (project octave):

                Severity:              3 - Normal => 2 - Minor              
                Priority:              5 - Normal => 3 - Low                

    _______________________________________________________

Follow-up Comment #6:

Since 'sizeof' is not a defined Matlab function or object method, it's
intentionally not used as an override when getting the size of objects in
'whos'.

I tested with 'containers.Map' in the Matlab online feature, and the size of
the map object is 8 bytes, regardless of how many entries are added to the
map.

I found this:
https://www.mathworks.com/matlabcentral/answers/14837-how-to-get-size-of-an-object

Where a Mathworks employee wrote

> Unfortunately, there is no way to check the amount of memory that is being
> occupied by class objects, since MATLAB is storing references to C++
> objects. As you say, whos is representing the size of the pointer to the
> created object, which will be 60 bytes (in 32-bit) or 112 bytes (in
64-bit).
> 
> However, you can create a function in your class and calculate the real
> memory of the object by manually querying for the memory of each of the
> properties in the class, like you do with whos for a matrix.

So I think we can choose to return whatever we want to for 'whos' and 'sizeof'
on class objects, since there is no compatibility problem here.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55810>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]