As explained in previous solution, there are numerous reasons why an application may consume a lot of memory. When creating an application, you can control some of the reasons but some you can't. For example if you use a badly designed driver that causes the memory consumption.
As a developer you need to take care that you don't store unnecessary things in memory and release the memory when not needed anymore. For example, If you're developing with C#, one thing is that you should take care that references that are not needed any more are properly released and objects are disposed when applicable. This way you take care that garbage collector can remove unused objects from memory. You can dive into more details at
Garbage Collector Basics and Performance Hints[
^]
Also development environments often offer tools to investigate memory related issues among other things. For example Visual Studio has a lot of capabilities to investigate memory consumption. For details have a look at
Analyze Memory Usage in Visual Studio - Visual Studio | Microsoft Docs[
^]