Book Image

Learning .NET High-performance Programming

By : Antonio Esposito
Book Image

Learning .NET High-performance Programming

By: Antonio Esposito

Overview of this book

Table of Contents (16 chapters)
Learning .NET High-performance Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Memory management


When talking about memory management, any code programmer will remember how native languages opened their doors to any kind of issues and bottlenecks. This can also mean that the expert C++ programmer could have access to some customization to produce better memory management than CLR does. However, this relates only to very few people in very few cases.

Theoretically speaking, when a programmer needs to use some memory to store any value in an operation, they need to:

  • Define a variable of the chosen type

  • Allocate enough free memory to contain the variable:

    • Reserve some bytes in the operating system's memory stack to contain the variable

  • Use the variable:

    • Instantiate the variable with the needed value

    • Do whatever is needed with such variable, for example - Define variable, allocate memory, use your variable, deallocate memory

  • De-allocate the freed memory:

    • Once the variable becomes useless, free the related memory for further usage by this or other applications

Other than the usual...