Jump to content

A few questions about MEMORY


Recommended Posts

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!

Link to comment

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.

Link to comment

QUOTE (BrokenArrow @ Feb 26 2009, 11:24 AM)

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.

Link to comment

QUOTE (ned @ Feb 26 2009, 12:46 PM)

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.