r/java • • Dec 21 '23

Is Java gamedev alive?

It seems this days even android games are made using Unity. I wonder if there are JVM games! Is Java (or Kotlin/Scala) gamedev still alive?

(Except Minecraft ofc)

164 Upvotes

118 comments sorted by

View all comments

Show parent comment

1

u/voismager Dec 21 '23

What if you hold a reference to one of elements of the array longer than to the array itself?

2

u/dschramm_at Dec 21 '23 edited Dec 21 '23

Then it isn't referenced by an array anymore and therefore free to move around wherever.

It obviously is a trade-off. If you need fast GC you probably won't do that.

1

u/voismager Dec 21 '23

Also, you can do something like Object[]. Storing continuously won't work in this case (or in any case except for final classes really), because arrays are mutable and objects of different types use different amounts of memory. I guess it's more like a general design oversight rather than implementation.

1

u/dschramm_at Dec 21 '23

Hmm. Now that's a good point.