5 ms·
just look at hand the performance articles on Java. Just look at the hand performance articles on C... People talk about it because you can do it, not because
by ynniv 10y ago
just look at hand the performance articles on Java.
Just look at the hand performance articles on C... People talk about it because you can do it, not because you have to do it.
- paulddraper 10y agoAnd you can do it because someone found that it was necessary to do. It's crazy I can't tell Java and NodeJS "use the memory you need". Instead I have to specify max memory sizes (and then watch as they inevitably consume all of it).
- renox 10y ago> It's crazy I can't tell Java and NodeJS "use the memory you need". Define the 'memory you need'? You know the computer doesn't have a cristal ball to know what latency vs memory usage trade off you want..
- aianus 10y ago"Until the OS refuses to give you more" Just like every compiled, non-GC program gets. It's annoying af to fiddle with interpreter/VM "maximum heap sizes".
- munificent 10y agoAlas, "until the OS refuses to give you more" is also not a meaningful signal anymore. https://en.wikipedia.org/wiki/Memory_overcommitment https://en.wikipedia.org/wiki/Memory_overcommitment
- dikaiosune 10y agoTracing garbage collectors have to have some metric for when to trigger a stop-the-world collection. IIRC, many GCs track heap usage and trigger stop-the-world when it gets above a threshold. GC'd language runtimes which don't have a tracing/compacting collector (e.g. CPython with refcounting) don't need to configure a heap size because the behavior doesn't vary as you use up your heap.
- aianus 10y agoThat's still no good reason to throw all kinds of "Out Of Memory" errors when you're hitting 1GB out of the 16GB of physical memory on my system.
- mike_hearn 10y agoThat's what most GCs do set the default max heap size to, assuming you don't have a swap file.
- happyslobro 10y agoI wonder, could we just tell each JVM instance that it may use all of the memory on the system, and then let the OS kill the first VM that allocates more than the system has to offer? Would this get us the same semantics as those of a native application? Or does the JVM preallocate all of the memory that it is allowed to use?
- mcosta 10y agoThe JVM allocates at start a portion, takes what it needs whenever it needs until the max, but never releases memory back to the OS. So in a given moment a 6GB vm is a 5GB process but internally is using just 3GB.
- jerven 10y agoThe standard JVMs do give memory back. The standard settings are not very friendly to do so but it does work.
- mcosta 10y agoA native application on what OS?
- mike_hearn 10y agoAs of one of the most recent Java releases, I believe the G1 GC does this on Windows. G1 is not the default but can be selected with a single command line flag.
- wtetzner 10y agoOf course they will consume all of it. That's how GCs typically work. They won't invoke a collection until there's no space left to allocate. Just because they "use all of it" doesn't mean all of that memory is actually live. It just hasn't done a collection yet.
- paulddraper 10y ago> Of course they will consume all of it. That's how GCs typically work. Perfect agreement.
- oldmanjay 10y agoThe disagreement probably lies in your characterization of the GC behavior as "crazy" when it merely doesn't suit your tastes.
- deleted 10y ago[deleted]
- yoklov 10y agoMost of the articles I see on C performance tuning are generalizable to any programming language, GC or no. Stuff like maintaining cache coherency, avoiding false sharing for threaded code, etc. I don't write java, but my impression is the articles being talked about are much more java specific than the C ones are (C specific).
- deleted 10y ago[deleted]
- Narishma 10y agoCache locality, not coherency.