3 ms·
I think technically you could achieve this by having multiple heaps, kind of like custom allocators in other languages. If Java had a placement syntax like ne
by cromwellian 12y ago
I think technically you could achieve this by having multiple heaps, kind of like custom allocators in other languages.
If Java had a placement syntax like
new (HeapReference) SomeClass(); => allocate in custom Heap
Then you could just turn off GC for that heap, and then blow the whole thing away when it got full. Or, you could have a more fine grained API to allow GC on these custom heaps. Perhaps you could even allow copying objects back to the main heap. You'd have to ban cross heap references or have a smart API that lets users pin an object in the main heap while it is known to be referenced by an object in custom heap.
Most of the time in client applications, you only care about GC pauses on the main UI rendering thread, but GC pauses in other threads are less obvious because there's no jank, just that latency may go up for some operations.
You could have a kind of best of both worlds with languages that support non-GC allocation for your UI thread, but GC everywhere else.
- pjmlp 12y agoYou just did a partial description how real time Java works.