There is ways to get the actual size (byte) of the IDL variables.
1. Use built-in size function
FUNCTION sizeof, DataItem
;
; First get the information regarding the item
;
Info = SIZE (DataItem)
;
; Deduce type and number of elements
;
Type = info (info (0) +1)
Nitems = info (info (0) +2)
Size = 0
;
; Calculate number of bytes depending on item type
;
Case Type of
1:size = 1 * nitems
2:size = 2 * nitems
3:size = 4 * nitems
4:size = 4 * nitems
5:size = 8 * nitems
6:size = 8 * nitems
7:size = 1 * nitems
8:begin
Tags = Tag_names (DataItem)
Info1 = SIZE (Tags)
For j = 0, Info1 (Info1 (0) +2)-1 do BEGIN
String = "size = size + sizeof (DataItem." + Tags (j) + ")"
ret = EXECUTE (String)
ENDfor
END
Endcase
;
; Return size in bytes
;
RETURN, LONG (Size)
END
2. Use the structure information
Structure = {Variable:variable}
Help, Structure
The prompt would print out the actual number of bytes that variable Occupys.