Clearing app memory between launches

Clearing app memory between launches

tomas.gunnarsson
Participant Participant
688 Views
3 Replies
Message 1 of 4

Clearing app memory between launches

tomas.gunnarsson
Participant
Participant

Hello!

 

I've made an app for revit that exports documents from a project, the issue im having is that in the app there are several WPF comboboxes etc that grabs information from the active project, so when i open a new project or switch window to a different one the app crashes as view ids, element ids and so on no longer matches.

 

My work around is to register the DocumentOpened event and activeview change event and close the app when it notices that the active project has changed. This works fine and its not an user issue as the app is fairly lightweight and its quick to get started again.

 

But when i open upp the app a second time, it has saved the previous pages and windows in what im guessing is the memory, some form of cache or whatever, which again makes the app crash.

Is there any way of clearing this memory? or forcing the app to start "fresh" at each launch?

the .close() command of the window doesnt seem to be enough.

 

any help is appreciated.

0 Likes
Accepted solutions (1)
689 Views
3 Replies
Replies (3)
Message 2 of 4

MarryTookMyCoffe
Collaborator
Collaborator
Accepted solution
I hard to say just from data you provide. But if I had to guess you are using static property some where .
If you try to make a window that don't freeze revit you need to be very careful about memory management. basic knowledge of how memory allocation in c++ work, is very beneficial here.
-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 3 of 4

tomas.gunnarsson
Participant
Participant

thanks for your reply.

 

wish i could provide some examples but the code is rather big and the problem occurs at several places.

your right, theres a couple of static properties, thought they would reset at close though but apparently not. going to look through the memory management, thanks for the tip

0 Likes
Message 4 of 4

tomas.gunnarsson
Participant
Participant

went through all the static properties and it fixed my problem, thanks! 🙂

0 Likes