In functional programming since almost all data structure are immutable, when the state has to change a new structure is created. Does this mean a lot more memory usage?

That depends on the data structure, the exact changes you performed and, in some cases, the optimizer. As one example let's consider prepending to a list:

list2 = prepend(42, list1) // list2 is now a list that contains 42 followed // by the elements of list1. list1 is unchanged

Here the additional memory requirement is constant - so is the runtime cost of calling prepend . Why? Because prepend simply creates a new cell which has 42 as its head and list1 as its tail. It does not have to copy or otherwise iterate over list2 to achieve this. That is, except for the memory required to store 42 , list2 reuses the same memory that is used by list1 . Since both lists are immutable, this sharing is perfectly safe.

Similarly, when working with balanced tree structures, most operations require only a logarithmic amount of additional space because everything, but one path of the tree may be shared.