Simon Willison’s Weblog

Subscribe
Atom feed for memory Random

12 posts tagged “memory”

2026

The memory shortage is causing a repricing of consumer electronics (via) David Oks provides the clearest explanation I've seen yet of why consumer products that use memory are likely to get significantly more expensive over the next few years.

The short version is that memory manufacturers - of which there are just three remaining large companies - have a fixed capacity in terms of how many wafers they can process at any one time. This fixed wafer capacity is then split between DDR - used in desktops and servers, LPDDR - used in mobile phones and low-energy devices, and HBM - used with GPUs.

Until recently, HBM got just 2% of that wafer allocation. The enormous growth in AI data centers has pushed that up to an expected 20% by the end of 2026, and "a single gigabyte of HBM consumes more than three times the wafer capacity that a gigabyte of DDR or LPDDR does".

Memory companies have learned from the extinction of their rivals that you should always under-provision rather than over-provision your fabricator capacity. The profit margins and demand for HBM (high-bandwidth memory) will constrain the production of consumer-device RAM for several years.

This is already being felt in the sub-$100 smartphone market, which is particularly important to markets like Africa and South Asia.

(The original title of the piece was "AI is killing the cheap smartphone" but I'm using the Hacker News rephrased title, which I think does more justice to the content.)

# 22nd May 2026, 10:01 pm / memory, ai, ai-ethics

2025

The surprising way to save memory with BytesIO (via) Itamar Turner-Trauring explains that if you have a BytesIO object in Python calling .read() on it will create a full copy of that object, doubling the amount of memory used - but calling .getvalue() returns a bytes object that uses no additional memory, instead using copy-on-write.

.getbuffer() is another memory-efficient option but it returns a memoryview which has less methods than the bytes you get back from .getvalue()- it doesn't have .find() for example.

# 31st January 2025, 3:57 am / memory, python

2019

Using memory-profiler to debug excessive memory usage in healthkit-to-sqlite. This morning I figured out how to use the memory-profiler module (and mprof command line tool) to debug memory usage of Python processes. I added the details, including screenshots, to this GitHub issue. It helped me knock down RAM usage for my healthkit-to-sqlite from 2.5GB to just 80MB by making smarter usage of the ElementTree pull parser.

# 24th July 2019, 8:25 am / elementtree, memory, profiling, python, xml

This paper introduces Mesh, a plug-in replacement for malloc that, for the first time, eliminates fragmentation in unmodified C/C++ applications. Mesh combines novel randomized algorithms with widely-supported virtual memory operations to provably reduce fragmentation, breaking the classical Robson bounds with high probability. Mesh generally matches the runtime performance of state-of-the-art memory allocators while reducing memory consumption; in particular, it reduces the memory of consumption of Firefox by 16% and Redis by 39%.

Mesh: Compacting Memory Management for C/C++ Applications

# 18th February 2019, 3:26 pm / firefox, memory, redis

2013

Does creating a zip file with php use more RAM then CPU? Or vise versa? Also, is it faster to use a system call, or the php zip library? Exec (zip filename.zip) vs. $zip =new ZipArchive().

You can find out the answer yourself using a very simple benchmark—just call time() before and after each option and loop them a few thousand times to calculate an average.

[... 74 words]

2011

How much ram do you need for 100M hits per day?

That entirely depends on what you are running your site on. If it’s static HTML pages, nginx will work fine on hardly any RAM at all (though you would probably be better off serving the entire site out of S3 and not using a VPS at all).

[... 99 words]

2010

Redis Virtual Memory: the story and the code. Fascinating overview of the virtual memory feature coming to Redis 2.0, which will remove the requirement that all Redis data fit in RAM. Keys still stay in RAM, but rarely accessed values will be swapped to disk. 16 GB of RAM will be enough to hold 100 million keys, each with a value as large as you like.

# 9th February 2010, 3:59 pm / databases, keyvaluestores, memory, redis, salvatore-sanfilippo, virtualmemory

2009

Using Graphics Card Memory as Swap (via) Interesting idea: “Graphic cards contain a lot of very fast RAM, typically between 64 and 512 MB. With Linux, it’s possible to use it as swap space, or even as RAM disk.”

# 3rd November 2009, 11:01 am / graphicscards, linux, memory, ops, performance, ram, sysadmin

Finding and fixing memory leaks in Python. Using Dozer, a clever piece of WSGI middleware which displays sparklines of Python object counts and allows you to introspect them, using the gc module under the hood.

# 22nd April 2009, 12:16 pm / amir-salihefendic, debugging, memory, memoryleaks, middleware, python, wsgi

Heap Dump Analysis. Using jmap to dump the JVM’s memory to disk, then analysing it using the visualvm GUI tool.

# 2nd April 2009, 10:34 am / dominic-mitchell, heapdump, java, jvm, memory, profiling, visualvm

2008

Troubleshooting Memory Usage. Useful for getting the most out of a VPS.

# 23rd January 2008, 6:52 pm / hosting, memory, vps

2004

Python Memory Management (via) It’s not quite as straight forward as you might have thought.

# 8th November 2004, 12:43 pm / memory, python