Originally posted by anda_skoa
View Post
Announcement
Collapse
No announcement yet.
PlayOnLinux 5 To Switch From Being Written In Python To Using Java
Collapse
X
-
Originally posted by anda_skoa View PostAre you sure?
My understanding was that primitive types used as members, function arguments or local variable were always allocated on the stack.
And that the heap allocation problem was only triggered by autoboxing, when primitive types need to be passed to methods expecting objects, e.g. generic container.
Cheers,
_
Comment
-
Originally posted by smitty3268 View Post
I think it's more that .NET uses the stack with things like ints/structs/etc. rather than forcing even a value of int 0 to be an allocated object from the heap. (Unless java has improved recently?)
Sorry for jumping at your post (despite having read several other posts which do not seem to state facts), but an int is not allocated on the heap except in one specific case and that is when escape analysis can not be done, i.e. if the int is the member of an object instance, in any other case it's placed on the stack.
Comment
Comment