Thanks for helping me! Just to make sure I understood correctly - at least for neko there are only two cases where the memory is shared automatically:
- Int values - no matter if generated at runtime through calculation or as static fields
- String values - but only if declared in code
- Float values - but only if declared in code
I did some research about "unboxed" and I think I somehow understand what it means - and therefore I hope I got you right and "don't take any money" does just mean they share memory as well. :)
So now I need to understand how much memory a pointer actually allocates and if it worth to create a map with little objects holding 20.000 "FloatObject"s like {value:0.0} with values from -100.00 to 100.00 - which will be used a million times in fields pointing to a FloatObject rather than always having a field of type Float.
So the question is (and I did some research without really understanding it): How much memory does a pointer use? If I get that right a pointer is just a reference to a object stored somewhere else in memory and therefore must be some kind of address which might be an Integer? And if it's an Integer - will every pointer to the same object share it's memory and therefore exist only once even if I point to an object a thousand times?