Small Memory Software: Patterns for systems with limited memory
smallmemory.com
smallmemory.com
Likewise, the use of C++ and Java in a book about "limited memory" is a bit unusual.
Then again, I'm really not keen on the whole "patterns" thing, because from experience I've found it tends to replace careful thought with dogmatic application of rules that might not be relevant at all to the situation at hand.
Java has many different versions. For example the smallest one (JavaCard) can run on tiny chips in smartcards, so Java as a whole may be a bad generalisation, but it's definitely possible.
Writing good, modern C++ means using the external template libraries and all kinds of (relatively) heavyweight goodies. The trouble is it's difficult to predict the space cost of those goodies -- so on systems where that matters it's just easier to think in terms of C.
I've used templates in C++ libraries for the purposes of varying memory constraints and mcu capabilities. Being able to write a library once and deploy it on 8 bit and 32 bit chips without FPUs and chips with fpus means saving a lot of time, and it writes code that's just as efficient. Finally, a lot of C/C++ compilers for small devices have routines to give a pretty good guess as to how much RAM your code's going to need, so you can figure out ahead of time if a routine is really worth it.
My original comment was more about the fact that despite using C++ and Java exampees, this book is quite strongly lacking any advice in the "use templates and other abstractions sparingly" direction.
Now you can wrap them up in C++, but then making such things hidden I think defeats some of their usage.
A managed runtime should be handle this better, but I don't know of any Java or .NET runtime that is optimised for a small memory foot print, perhaps paging from a larger virtual space[1]. I'd be interested to hear of any really.
[1] I do know there have been versions of Smalltalk that did basically this, but nothing recently that I've heard of.
You could argue that if you end up disabling all the fancy stuff from C++ why use C++ at all. But anyway, you can definitely use C++ in low memory environments if you really want to.
I was surprised to see that the architecture section of the book had recommendations that Android implements (I work on AOSP for a living). I see striking similarities. If the original Android team had consulted this book, then they got a lot of stuff for free... if they didn't, it only re-enforces the fact that patterns do matter. In Android's case, they seem to fit in like a glove.
Someone can correct me, but except for the Read-only Memory and subsequent parts, I think Android seems to have most of the other suggestions implemented.
To others: The books is fairly approachable. Skimming the topics and sub-topics themselves reveal a lot. Absolute gem of a book, IMO.
That said, understanding how to design in tight memory constraints is useful. While typically only seriously practiced by embedded systems developers, having habits that minimize memory use can have a large impact at scale. The paper gives some good reasons on what the benefits of those habits are, but I also think that, as a percentage of the total, programmers living in constrained memory spaces are a specialization not the mainstream any more.
In my experience 'small-batch distributed jobs' (~5 machines) are often candidates for memory optimization. Especially if written in high-level languages without easy access to struct packing.
So the results will probably be pretty similar on ARM as well.
It boggles me that a machine that could hold six hundred uncompressed 1080p video frames is my most memory constrained computer.
I'm on board with Niklaus Wirth: https://cr.yp.to/bib/1995/wirth.pdf
Memory consumption can be a primary issue for small embedded targets. Upgrading the hardware is often not an option or is actually more costly than development time, because development is a one-time cost, while adding RAM or flash is an extra production cost (so a per-unit cost).
Moreover, embedded software tends to be more stable feature-wise than desktop or server software: once it's done, you can expect that it won't be modified for a few years. From my experience, the smaller the system the more "carved in stone" it is.
Finally, it should be noticed than on "normal" systems, memory size is still important because of the many caches they feature.
http://www.7-cpu.com/cpu/Skylake.html
L1 cache: 32 KiB, 4 clock cycles (=1 nanosecond) latency
L3 cache: (Up to) 8 MiB… with a latency (42ns) equivalent of 2½ branch mispredictions. You know, the things that Everyone Knows™ they should avoid with compiler hints like __builtin_expect.
RAM: As much as you want… at 246 cycles (61.5ns) latency.
I run Gnome and Debian. I looked a bit at the System Monitor. All the standard unix tools (like cron...) are tiny. They only use few Kb. They big consumers are gui related and the heaviest is Firefox with 500 Mb. I have 4Gb of ram.
Some webpages are use a hell lot of memory.
But there are big problems with webapps, too. For example, there are small apps that do super basic things and that can't be run on a Heroku free dyno. Mainly those written with Ruby on Rails, I guess -- like Discourse, and other small apps I've seen, but I've seen others.
Start a new instance with a clean profile. I doubt it will go over 100mb, probably less.
Do you mean remove the .mozilla directory?
But yeah, you could do it the hard way, by removing/renaming the .mozilla folder.