How to free list memory using apex?

How to free list memory using apex?

MyList.clear();

Where MyList is a List variable.


Example:


List<Account> MyList = new List<Account>();
MyList.add(new Account(name = 'test');
MyList.clear(); // Removes the accounts




Cheers!!!

Leave a Reply