Study Lifecycle

Evolver

New member
Joined
May 2, 2020
Posts
3
Likes
0
I noticed that when I update a study and do a 'touch .last_updated' that the previous study wasn't deallocated.

What is the method that is called to deallocate a study?

Is my only option to quite MW to ensure the older version has been unloaded?
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Hello @Evolver and welcome to the MW Forums ! :)

I am not 100% sure what it is exactly you are looking for but I can tell you this:

  • you build a (newer version of) a Study in your IDE
  • the .last_updated gets altered ("touched") during the build process
  • MW realizes the .last_updated is altered and reads in the new info, effectively updating the Study in the MW Platform (you can actually 'see' this happening: when you are looking at a chart that contains the Study that you update, the screen flashes briefly a few seconds after your IDE completed the build)
  • from now on you are working with the newer version of the Study. You can easily check this by opening its menu. If you made changes to the inputs / parameters / text /... you will immediately see them
I do not think that if you remove a Study from a chart (or all charts that contain it), the .last_updated gets altered.
From the SDK Programming guide:
198

The only thing I notice is that memory gets 'de-allocated', especially if I remove 'larger / heavier' studies.
I can tell this happens by looking at the 'memory allocation bar' in the bottom right of my screen:

199

I hope this helps. Please clarify if this is not what you were aiming for :)
 

Evolver

New member
Joined
May 2, 2020
Posts
3
Likes
0
Thanks for the response Spin!

I'm creating a web-socket connection from within a Study to a local server. I'm doing a terminal output from the local server when a connection is made or lost. The Study is not dropping the connection when we update the Study using `touch .last_updated`. It seems the only reliable way to drop the connection is by quitting MW.

Because the connection is 1:1 between MW and my local server, I've decided to use a singleton and add metadata to the information being sent over to my local server.

MW's memory management is damn impressive! I feel that understanding the Study lifecycle would help ensure my code isn't throwing this off in anyway.
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Oh, I see. Muchos interessantes, that web-socket connection !! :ROFLMAO:

I was planning to do that too, someday. It would be nice to get Study output onto a website for remote monitoring. (would you be willing to post parts of your code to get me / others here going ?)

You caught my drift already: I am still nowhere when it comes to connecting MW to a (local) server, so I am afraid I cannot help you any further in that field.

But I have had my share of "MW SDK cursing because I cannot find the reason why sh*t doesn't work", so I guess I've picked up a thing or two about the SDK's inner workings. Please feel free to pick my (or the MW Community's) brain :)
 
Top