To all
I am looking for some info on managing memory with NX programming/journaling. I do not know if there is such thing but I thought I’d ask. I know for example that if one creates a “Builder” variable one ought to destroy it once finished with it as per example below
I have a couple of programs with an UI builder GUI and listboxes and I have noticed the following;
if I launch the program for the very 1st time it seems that the GUI is displayed (very) quickly. Then every subsequent launch of the program the GUI takes longer (and longer!) to be displayed.
I do not have “timing” number but it seems quite obvious that the “display GUI” is slow-er
When I close the GUI (cancel_cb callback) I simply close the LW window (TheLW.CloseWindow() )
Any pointers/good coding practice(s), etc one ought to consider?
Thanks
Regards
example builder
Dim myRSEventBuilder As CAE.ResponseSimulation.RSEventBuilder = theRespSimManager.Events.CreateEventBuilder(theActiveRSEvent)
Dim stheActiveRSEventType As String = myRSEventBuilder.EventType.ToString
myRSEventBuilder.Destroy()
re: memory management
Memory management, in part, depends on what programming language and API you are using. For example, if you use C++, then memory management is entirely up to you. However, it appears that you are using one of the .NET languages (VB.net). In this case, the .net framework is supposed to do most of the memory management for you; as long as you remember to destroy objects when you are done with them, the .net garbage collector should take care of the rest.
I've not had the pleasure of using the NX UI builder, so I'm not sure how that plays into memory management, if at all.
Are you compiling your code to a .dll file? If so, what "unload option" are you using? If you use the "at termination" option, NX will keep your code loaded in memory until the end of the NX session. This option should give the best response speed when starting your program on subsequent runs. If you use the "immediately" unload option, this means that your code is unloaded as soon as it is finished executing. The next time you run your code, it has to be loaded into memory before it can start executing. If you are running your code as a journal file, NX has to compile and load the code each time that it is run. This would lead to the slowest startup times.
RE:memory management
Thanks for the pointers. I am coding in VB .net and I am not using .dll. (cannot do it). I am essentially running "raw" code form a .vb file. Codes are only for me so not a big deal. Because I am not using .dll I take it the "unload option" make no difference
Thanks
Regards
re: memory management
If you are running your code as a journal (or "raw" code from .vb file as you put it), then you have no control of the unload option. NX will automatically use the "immediately" unload option; meaning your code has to be compiled and loaded each time it is run.