2 ms·
> Sounds like you're conflating GC with Java's limited type/value system. Well, yes. It's the JVM that seems to prevent value objects, not Java per se. Since a
by iofj 10y ago
> Sounds like you're conflating GC with Java's limited type/value system.
Well, yes. It's the JVM that seems to prevent value objects, not Java per se. Since async GC will need RTTI this is going to be more general than just Java (it needs to know, given only memory adress, what the type of the object is, which means it needs at least a pointer in there (these days 8 bytes)). I also don't know any VM that really does a better job.
> In C++ minimum object size is 0 bytes.
C++ minimum object size is 1 byte (since 2 objects can't have the same address).
> Boxed primitives are actual Java objects.
I should have been clearer : I meant classes with fields, as apparently a class with a single int is bigger than a boxed Integer in the JVM.