- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to avoid memory leakage in SAP B1 DI API
The thumb rule goes like this, if you instantiate a DI API object, you have to release it. if you don't release it explicitly, it will result in memory leaks.
You can use a ReleaseComObject method to release the object memory. In case if you try to release a null object, it will throw an exception.
So, it will be better to have a null check before you try to release the object.
Sample snippet:
if (obj != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
Advertisements