Issue
Memory consumption window appears to be inaccurate.
Product Line
Unity Pro, Control Expert 14
Environment
Windows 10, Windows 7
Resolution
The memory consumption window appears to be inaccurate. If a new variable is added (i.e., REAL, etc.),
the value shown in the Memory Consumption window does not change.
This feature works as designed. The displayed value is correct. The reason for issue is due to the following he behavior:
For instance, if you, declare a variable of type BYTE (1 byte of memory is required). It could result in the
memory consumption screen increasing by 16 bytes with only 1 byte used. However, if you declare another variable with
same type (or another type), the value shown in the screen will not change because the remaining 15 bytes left is reserved for later
use on the next declared variables.
Variable constraint infers that the variable must be allocated in memory to an offset which is a multiple of its size.
The maximum variable alignment constraint is 4. This means that if you declare a variable using a type with a large byte
size (i.e., DDT or ARRAY). Unity does not use the type size for alignment constraint. Instead, it uses the value of 4.
A two (2 ) bytes size variable must be allocated to an offset multiple of 2. As a result, there could be a small gap
in memory.
i.e.,
If the 3 bytes of the 16 bytes were already allocated when a new two byte variable is added, the new variable would be assigned to the bytes 5 and 6.
Memory consumption window appears to be inaccurate.
Product Line
Unity Pro, Control Expert 14
Environment
Windows 10, Windows 7
Resolution
The memory consumption window appears to be inaccurate. If a new variable is added (i.e., REAL, etc.),
the value shown in the Memory Consumption window does not change.
This feature works as designed. The displayed value is correct. The reason for issue is due to the following he behavior:
- Variables are allocated in memory block.
- The size of a memory block is always a multiple of 16 bytes.
- Variable alignment constraint may generate small gaps in memory.
For instance, if you, declare a variable of type BYTE (1 byte of memory is required). It could result in the
memory consumption screen increasing by 16 bytes with only 1 byte used. However, if you declare another variable with
same type (or another type), the value shown in the screen will not change because the remaining 15 bytes left is reserved for later
use on the next declared variables.
Variable constraint infers that the variable must be allocated in memory to an offset which is a multiple of its size.
The maximum variable alignment constraint is 4. This means that if you declare a variable using a type with a large byte
size (i.e., DDT or ARRAY). Unity does not use the type size for alignment constraint. Instead, it uses the value of 4.
A two (2 ) bytes size variable must be allocated to an offset multiple of 2. As a result, there could be a small gap
in memory.
i.e.,
If the 3 bytes of the 16 bytes were already allocated when a new two byte variable is added, the new variable would be assigned to the bytes 5 and 6.