How to allocate memory in C-sharp

see the garbage collection principle of C-sharp on the Internet, using the concept of big and small heap and generation, big and small heap is easy to understand. As far as I understand it, every time there is no recycling, it is pressed to the next generation. At this time, I feel that it has already moved, but I have freed up a larger piece of continuous space, and only one generation is recycled at a time. In this way, when the memory is not enough to recycle, the number of moves is reduced because only this generation is recycled.
I wonder if my understanding of generations is correct. Please correct it.
finally, I would like to ask, how does the principle of garbage collection help our code, and how can we use the principle of garbage collection to improve our code?

Oct.25,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b398fd-4072e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b398fd-4072e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?