September 20, 2019 | 11:05
Researchers at the University of Massachusetts at Amherst have unveiled a tool dubbed Mesh which, they claim, could have a substantial impact on the performance of everything from smartphones to supercomputers by resolving the memory fragmentation problem.
While the quote commonly attributed to Bill Gates that '640kB should be enough for anyone' is apocryphal, it's a fact well known that early computers were somewhat memory-starved. The Commodore 64, the single best-selling home computer of all time, had as its name implies just 64kB of memory - but today it's not unusual to see a high-end desktop for the well-heeled pushing 64GB. Having such generous quantities of memory available has arguably led to soft programming practices which rely on stretching lazily out rather than tightly controlling memory use - but researchers at the University of Massachusetts at Amherst claim to have developed a plug-in which can help boost performance by reducing memory fragmentation.
Targeting C-like languages, including C++ and Objective C, Mesh is designed to resolve memory fragmentation without additional effort on the developer's part. 'This is how memory gets wasted," says lead author and designer of the algorithm used in macOS' memory management system Professor Emery Berger of the utility. "Imagine a Tetris board where you could stop and reorganise it at any time - this would make the game a lot easier, because you could always squeeze out the empty space. But you can't do this in C, just as you can't do it in Tetris.
'The trick is to find chunks of memory that can be interleaved, sort of like when interlocking gears mesh,' Berger explains. When two matching chunks are discovered Mesh literally meshes them together, compacting the memory - and by ensuring that programs are only accessing virtual memory, it does so invisibly. 'This meshing process works because we only change things in "physical" memory. From the perspective of the program, which can only see "virtual" memory, nothing has changed. This is powerful because we can do this for any application automatically.'
The technique has been proven on real-world workloads, too, for both desktop and server applications: Using Mesh, the memory needs of popular open-source web browser Firefox were cut by 16 percent; for the Redis in-memory database usage was cut by 39 percent.
'This is something that everyone thought to be impossible,' claims co-author Professor Andrew McGregor. 'After Emery had his key insight, we were able to analyse it theoretically and design an efficient algorithm to implement the idea. Against almost 50 years of conventional wisdom, it's great that we now have a solution to this important problem that not only works in theory, but is practical.'
The technical details of Mesh were first published
January 24 2020 | 12:00