Without memory, digital electronic circuits would be restricted to designs where the outputs are combinatorial expressions of the inputs. Memory provides state storage which is the basis of all forms of computation. Memories are a tradeoff between density, performance, cost, complexity, reliability, lifetime and many other factors meaning that the choice of memory type is sometimes a very complex decision. The types of memories have changed over time as new technologies have been developed and fabrication technologies for them matured.
Memory is often the first type of design to deploy new fabrication technologies. This is due to the fact that the cells are highly replicated and those cells are custom designed. Once a cell has been correctly defined, it can be replicated using a fixed grid without having many additional problems. This does not take into account the logic that may be necessary for reading, writing, refreshing or other maintenance functions.
Many different types of memory exist, and there are several ways in which they can be classified. The biggest divide is between those that are volatile and those that have some degree of persistence. The biggest example of a volatile memory is Dynamic Random Access Memory (DRAM). This is the main memory for computers. It can retain its contents for about 100ms. It extends this period by doing refresh cycles that “top up” the charges that represent the values. At the other end of the scale is something like flash memory that never has to be refreshed. You can also remove the power and it retains its state. Somewhere in the middle would be a Static Random Access Memory (SRAM). This does not require the refresh cycles of DRAM because the circuitry itself is providing that in a constant manner. However, it will lose its memory when the power is removed.
Another way in which memories is the number of times they are programmable. Here we find Read Only Memory (ROM) at one end of the scale. The program for it is decided at design time and fixed during chip fabrication. At the other end is SRAM or DRAM that have an effectively unlimited number of times that they can be reprogrammed. In the middle is something like flash that can be programmed a significant number of times, but they wear out in the process meaning that they have a finite lifetime.
Reference:
https://semiengineering.com/knowledge_centers/memory/