mecway doesn't release memory as it should

hi victor,

so i've noticed that if you open a file and mecway takes a lot of memory it doesn't release it if you open a different file. it keeps the memory it took from the larger file. the only way to clear the memory is to close mecway and re-open it. this isn't related to the solver. i watch the memory as it solves and that is taken and released as expected. just with the mecway process.

Comments

  • This is tricky to reproduce. I tried reloading the same large file repeatedly and the physical memory use reported by task manager for Mecway was:

    33 MB no file
    2325 MB opened once
    3695 MB opened twice
    3460 MB ...
    4731 MB
    3801 MB
    3020 MB
    2997 MB New file (empty)
    330 MB After waiting a few minutes then doing some simple general use like making an element and clicking on things.

    So I can't see any obvious memory leak. Temporarily growing memory use is normal since Mecway uses .Net which is garbage collected so memory that's no longer needed can sit around still allocated until whenever the garbage collector decides to free it, which can be triggered when available physical memory is low. So if you have a lot of RAM, it's reasonable that it will use more than it needs. It doesn't cost anything.

    Have you seen negative effects like other programs running slower because of lack of memory? If not, then I think it's OK to ignore.
  • One thing related to memory usage, for some big models on small machines, maybe Mecway took 3-4 Gb just to open the file, and then anothers to solve it; sometimes making imposible to solve due to low memory. If the problem (CCX) is solved by means of the Mecway command line modificator to just solve without GUI, will it copy the results to the liml file?
  • hey victor,

    sorry i didn't think it would be hard to duplicate. i will try to find the files i saw it with and send them to you. it's like sergio said. i have 8gb but 3.5 is already used by windows. i open the file and mecway takes another 2 gb. so i don't have much left for the solver to use. but that wouldn't really change with this issue. it's more of a convenience thing. mecway won't release it even though it no longer needs it. if you open a small file next it still holds the 2gb. you have to close mecway and reopen it for it to take the appropriate amount. so not a huge deal. but if it's something you could tweak, i think it would be good. the pardiso solver seems very good about taking and releasing memory. it also seems pretty frugal with memory as well. so those are both good things.
  • Sergio - the solve command line parameter doesn't save the solution by default which I realize is kind of strange, but if you set Write solution to liml file in Analysis settings -> Output files, then it will. That also allows you to keep the model and solution in separate files to reduce the size when you don't need the solution.

    prop_design - Yes, please show the results, especially after repeated file opens to see if it's accumulating and eventually exceeds physical memory or not. I'd also like to see that it has a negative impact on other applications before trying to do anything about it.
  • Thanks, will play a little tomorrow with that options, my big files took a while to open even if I´m using an ssd disk
  • edited May 2019
    so just trying some things now and i see what you mean about it being hard to duplicate. it looks like as you do things in mecway it will take more and more memory. so it's not just opening a file. so the only thing i would suggest is take a big file and process it like you normally would and keep and eye on the memory. once you think you have it topped out open a very small file. you will see the memory doesn't change. that part i can duplicate. i can't exactly duplicate when i saw it over 2gb of use. i got it up over 1gb. i think the bolt assembly i had in the other thread might be about the biggest model i have. so if you clear it and solve it and rotate around the results etc you might see it top 2gb but i can't be sure which model did it. it hasn't been a problem with other programs at all. it's just it should release the memory as soon as you open another file. at least in my opinion. if somehow it could release as much memory before a solve that would be ideal. as it would give the solver more memory to use. so i guess two different aspects to it. i was mainly focused on why it's not immediately released when you open a small file.
  • hi victor and sergio,

    i'm just curious how much memory windows uses on your computers. i think victor has said he has 16gb of memory and sergio said he had 32gb of memory. i guess on my laptop the 3.5gb of usage was with my web browsers open. i also have some hardware monitors running in the system tray and taskbar. as well as open shell. if i close the browsers it drops from 3.5gb to 2.4gb. i'm curious how much windows will take if i get a laptop with more memory in the future. i attached some pics of the memory usage. this is before opening mecway or anything else.
  • Yes, I saw the memory use remain high after doing a File -> New, which would be about the same as opening a small file. But high memory use is perfectly OK as long as it doesn't cause any problems.

    I left it in that high-memory, no-model state and opened 5 other instances of Mecway, each with the big file. When I got to the 5th one, memory used by the empty Mecway dropped from 2.5 GB to 400 MB and later to 40 MB without me doing anything to that instance at all. That happened just below the limit of physical memory on my computer. The memory was released as soon as it was needed by another process so I don't think it's a real problem, just an illusion of the memory usage meter.
  • oh that's great. i guess that's something windows does? i think they worked on the memory management many years ago. you used to have to use utilities to free up ram.
  • Mine says 2.9 GB (out of 16 GB) with not much else open. I wouldn't make any decisions based on these numbers though because how memory gets used is so complicated.
  • edited May 2019
    thanks victor. wrt to pardiso so far it has used around 2gb and that's about all i had available. i'll be curious if it can grab more from other apps. kinda like what you were describing. i may not have run a big enough model. i was getting the impression it was only going to take what was shown as available at the time. unfortunately that was only around 2gb out of 8gb. i'll update here if i notice something different. also great to know windows won't rob me if i get more memory. that was my fear since it seemed to be taking so much with 8gb.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!