What does dispose() do?

Hello,

i have dispose() in my script, but what does it do ? for what is it.
grafik

KR

Andreas

The Dispose method is primarily implemented to release unmanaged resources (to free memory that was allocated)

3 Likes

In python you can do this safely by using the with statement - python automatically does the ‘garbage’ collection (yes this is what it is called)

with Transaction(doc, "Words of wisdom here") as t:
    t.Start()
    # Do stuff to the document
    t.Commit() 

In Dynamo Python there is also the TransactionManager which does all the heavy lifting

3 Likes

@Mike.Buttery ,

is there some stuff to read, for better understanding?

the topic is reagarding how does the script “performe” you can safe runtime ?

KR

Andreas

This page has a good explanation → Context Managers and Python’s with Statement

1 Like

@Mike.Buttery ,

i think i understand, it means to releave file-Space. Because when i delete Parameters i confirm that they are do not anymore “exist”. Garbage Collection - Dispose Vs Finalize And IDisposable Pattern