3 ms·
"Free memory" in a garbage-collected managed language is difficult to measure. If you don't have to GC, the performance-minded choice would to not GC. Every com
by Zigurd 15y ago
"Free memory" in a garbage-collected managed language is difficult to measure. If you don't have to GC, the performance-minded choice would to not GC. Every computation costs battery life, so I would suppose Android's GC is tuned to not run if it doesn't have to.
If you look at the specifications of system.gc(), it can be implemented as a placebo, like the "push to walk" button at the street corner. So even explicitly GC'ing isn't guaranteed to do anything.
Android also has a strategy for "swapping" components within a process, and whole processes. This is, effectively, Android's GC strategy across processes. An Android system's memory, especially on small-memory devices, should always look full-ish, but you can almost always launch a new task, since GC and components and process "swapping" (the "destroy" phase of component lifecycle) and GC can almost always make room for more.
- inoop 15y agoI think the biggest problem with embedded GC is that you generally don't want to do pay the memory overhead that comes with generational algorithms. It's a pity that most Java systems are layered on top of some C-based OS, so that each process effectively has to have its own heap, with all the memory overprovisioning that entails.
- reirob 15y agoCan you tell what you meant by "most Java systems"? Which are the Java systems that are NOT running on top of some C-based OS?
- inoop 15y agoManaged operating systems such as JNode (Java based) or Singularity (.NET based) have managed kernels - everything is written in a memory-safe language. The OS can verify the memory-safety of a program in the loader (bytecode verification), so that there is no need for an MMU to implement process isolation; different processes can share the same heap. There is also a big performance advantage as process switching is essentially as fast as thread switching. IPC is typically done using message passing, but Singularity for example also allows processes to set up a shared memory space. edit: relevant paper: https://agora.cs.illinois.edu/download/attachments/28320883/singularity-sigops07.pdf https://agora.cs.illinois.edu/download/attachments/28320883/...
- reirob 15y agoThanks for this information. I am curious to see in which domain such Operating Systems will be used first. I am wondering actually why Google did not use such an OS architecture for Android (or Apple for their phones).
- mulander 15y ago> like the "push to walk" button at the street corner. Thanks for using that comparison - oddly enough it provided some nice entertainment for me :D Since I wasn't aware if "push to walk" was a cultural reference that I might not know I started some quick research that lead me to a couple of interesting articles. I started off with a search that resulted in the Placebo Button (http://en.wikipedia.org/wiki/Placebo_button http://en.wikipedia.org/wiki/Placebo_button) article on wikipedia. From the references section in that article I found a nice column from NY times about the street crossing buttons in NY (http://www.nytimes.com/2004/02/27/nyregion/27BUTT.html http://www.nytimes.com/2004/02/27/nyregion/27BUTT.html). From which I picked up an interesting pattern in traffic control solutions - called the 'Barnes Dance'. Which lead me to this video (http://www.streetfilms.org/barnes-dance/ http://www.streetfilms.org/barnes-dance/) from which I learned that it's also known as Pedestrian scramble (http://en.wikipedia.org/wiki/Pedestrian_scramble http://en.wikipedia.org/wiki/Pedestrian_scramble). It's funny how a couple of well picked words on your side has lead me to an entertaining research. I just wanted to say thanks and share this experience :)