Comments by "Anony Mousse" (@anon_y_mousse) on "That One Time I Needed a Linked List" video.
-
2
-
If Android really has a problem with large contiguous blocks of memory, then the easy solution is multiple arrays. Still less memory than a linked list, regardless of how negligible you think one or two pointers are it can cause jagged allocation sizes which means more padding and can add up to a significant amount with the more frames you have. However, the correct solution would be to use low-level access and write your own allocator. Writing your own allocator means you can size the ring buffer to a specific amount of raw frames, tuned specifically for the platform that it's running on, and it'll be faster and lighter in every respect. It's a weird thought, but even with a singular operating system, you can still have different enough hardware that it requires tuning.
In general, I haven't found more than two real-world use-cases for linked lists when dealing with large amounts of data, and those two cases are still highly specialized. When you're storing just a few things, then a linked structure might be fine. If you need algorithmic structure, a tree will always be better than a flat list. If you merely need ordering, in 99% of cases an array is the best.
1