web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

When should finalize()/dispose() be called

(0) ShareShare
ReportReport
Posted on by

Hi

Does anyone know if there are circumstances in which I could encounter a memory leak if not calling finalize() or dispose() on an object.

Normally, I assume that an object instance that is declared locally gets garbage collected when leaving the method - but I would like to know if anyone has experienced anything else. I often use COM objects and/or .NET objects, and I don't know if they should be treated in a different manner.

Would be good to know...

/Jonas

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    Re: When should finalize()/dispose() be called

    Hi Jonas,

    Good question.  x++ does not use destructors so I would assume if you were calling a .NET AX object you wouldn't have to call finalize() or dispose()

    This is only my thoughts however.  If anything use exception handling where ever you are making an instance of an object in your code.

    Have a good week.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans