4 ms·
The JVM now has the epsilon GC, which does basically that, it just never GC’s. It’s unfortunate though that there’s no explicit way to tell java to free up a ce
by LadyCailin 7y ago
The JVM now has the epsilon GC, which does basically that, it just never GC’s. It’s unfortunate though that there’s no explicit way to tell java to free up a certain reference, if so, in combination with epsilon, you could write real time programs. Maybe you already can do something like that in the embedded java version though? Not sure.
- tempguy9999 7y agoInteresting. First I've heard of it. Well I guess if you can ensure bounded space by limited allocaton, then simply shove manually 'freed' stuff back on a free list, you could do that, sure. But a quick google gets https://openjdk.java.net/jeps/318 https://openjdk.java.net/jeps/318 which does say Non-Goals It is not a goal to introduce manual memory management features to Java language and/or JVM... but it doesn't say you can't or shouldn't. Game on then.
- LadyCailin 7y agoSure, if all your objects are mutable, then that can work, but a lot of stuff in core libraries are not, and you can’t control those allocations, short of not using them. There is also sun.misc.Unsafe, which has freeMemory, but first of all, I don’t know if that works for arbitrary addresses, or just ones previously allocated from the allocateMemory method, and anyways, I don’t think there’s a reliable way to get the address of an arbitrary object in the first place. But to add both of those pieces of functionality should be a pretty small patch to the jvm code anyways, so if someone were really motivated, it may not be all that much work anyways.
- tempguy9999 7y ago> and you can’t control those allocations You're totally right. Rather stupidly I hadn't thought of that.