BrokenArrow Posted February 27, 2009 Report Share Posted February 27, 2009 Hello everyone! I have some questions / comments about memory management. 1) I noticed today that after I disabled some stuff, my Data Space memory went UP a bit (by 0.2kb). Curious, I then deleted a two local variables and replaced them with constants. My memory went UP again (by 0.2kb). Putting the locals back, the memory went back down. Does this make any sense? It seems counter to what should happen. 2) If you could take a look at the attached JPG, do these ratios here look OK? If my "code" is taking 161kb, and "data" is taking up 99kb, seems like maybe I haven't wired my code as effieciently as I could to reduce data space allocation. Or maybe, that conclusion can't be gleaned from these figures? This code has no globals, but quite a few locals. It also has lots of dead-end tunnels which I'm slowly working out, but I don't think those make copies of data. (?). 3) Lately, I have been adding the Request Deallocation function to VI's that run just once per application, and never get a chance to run again. Also lately, I have noticed a bit more disk swapping on one of my computers which has only 1MB of ram. I haven't tried a before-and-after, because the disk swapping is hard to pin down. Has anyone had issues with the Request Deallocation? Thanks! Quote Link to comment
crelf Posted February 27, 2009 Report Share Posted February 27, 2009 QUOTE (BrokenArrow @ Feb 26 2009, 11:24 AM) ...I have noticed a bit more disk swapping on one of my computers which has only 1MB of ram. I'm really hoping that's a typo tha should be 1Gb... Quote Link to comment
TobyD Posted February 27, 2009 Report Share Posted February 27, 2009 QUOTE (crelf @ Feb 26 2009, 08:37 AM) I'm really hoping that's a typo tha should be 1Gb... Or 1GB would be even better It's been a long time since I used a computer running 1MB of RAM. Quote Link to comment
LAVA 1.0 Content Posted February 27, 2009 Report Share Posted February 27, 2009 QUOTE (BrokenArrow @ Feb 26 2009, 10:24 AM) 2)If you could take a look at the attached JPG, do these ratios here look OK? If my "code" is taking 161kb, and "data" is taking up 99kb, seems like maybe I haven't wired my code as effieciently as I could to reduce data space allocation. Or maybe, that conclusion can't be gleaned from these figures? This code has no globals, but quite a few locals. It also has lots of dead-end tunnels which I'm slowly working out, but I don't think those make copies of data. (?). It depends greatly on your specific code and may be perfectly okay. The most likely cause of having a lot of data memory are arrays. I can quickly create a VI with less than 10 kB of code and MBs of memory, by allocating large arrays. Also other large data structures like clusters will add to this. In regards to using lots of locals it depends on why and how you are using them. Quote Link to comment
BrokenArrow Posted February 27, 2009 Author Report Share Posted February 27, 2009 QUOTE (crelf @ Feb 26 2009, 11:37 AM) I'm really hoping that's a typo tha should be 1Gb... 1Gb, yes yes, 1Gb. I still can't get used to typing that. Back on topic, this VI has a few arrays that have values set as defaults (as aopposed to being empty by default). The profiler would probably catch those. Quote Link to comment
ned Posted February 27, 2009 Report Share Posted February 27, 2009 QUOTE (BrokenArrow @ Feb 26 2009, 11:24 AM) 1) I noticed today that after I disabled some stuff, my Data Space memory went UP a bit (by 0.2kb). Curious, I then deleted a two local variables and replaced them with constants. My memory went UP again (by 0.2kb). Putting the locals back, the memory went back down. Does this make any sense? It seems counter to what should happen. I wonder if this is related to this thread about memory allocation and constant values. LabVIEW includes constant values in its compiled code. If you then modify the constant at run-time (attempt to reuse its buffer), LabVIEW makes a new copy since it's effectively no longer constant. With a local variable, there's no value pre-compiled into the code so need to make a copy at run-time. Quote Link to comment
BrokenArrow Posted February 27, 2009 Author Report Share Posted February 27, 2009 QUOTE (ned @ Feb 26 2009, 12:46 PM) I wonder if this is related to this thread Not directly related, no. QUOTE (ned @ Feb 26 2009, 12:46 PM) With a local variable, there's no value pre-compiled into the code so need to make a copy at run-time. Perfect. Thanks for the explanation. What was that thing I saw a few weeks ago about the difference between wiring a constant to the top or bottom of a comparison or simple math function, and the effect on memory? I can't find it. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.