Jump to content

"Memory is full" when MathScript range (MC_Range.vi) has an empty input


Stan West

Recommended Posts

The attached VI contains a MathScript node that creates a range with an empty matrix as the start index. Rather than raising an error in an error cluster, MC_Range tries to initialize an array of size 2147483647; LabVIEW then halts VI execution and raises a dialog box that reads, "LabVIEW: Memory is full. VI 'MC_Range Test.vi' was stopped at Initialize Array 0x430C of subVI 'MC_Range.vi'." The same problem occurs if the step or end of the range are empty.

Download File:post-4854-1157639128.vi

Link to comment
array of size 2147483647

Hi Stan,

your VI doesn't open well on my machine but I think this is totally normal, you are creating an array of 2 G datapoints. With just normal U16 datatype you need a memory of 4 GB, for standard floating points (DBL) you need 16 GB memoryspace (timestamp 32 GB). The reason LV stops and not creates a 'normal' error is because the memory managemend is violated, it could be that LV just executes and want to allocate the memory, your OS is handling that (and can create extra memory on disk.

What if LV continued and you didn't check for an error (even more the standard way to initiliaze an array has no error output then the function of your program was totally unreliable.

Ton

Link to comment

Ton,

I agree that the memory error makes sense when such a large array is being initialized. However, my concern was not with that error itself but rather that such a situation (and a terminal error) would arise simply because one parameter of the start:step:end range operation is an empty matrix. Now I created such a situation accidentally, due to an error in my prior code, and having an empty matrix in a range doesn't seem useful, so this specific condition may be uninteresting in practice. Nevertheless, I would rather see MC_Range.vi behave better for odd inputs. For comparison, the behavior of Matlab 7.0 is as follows:

>> range=[]:1	Warning: Colon operands must be real scalars.	range =		Empty matrix: 1-by-0

Apparently, it prints a warning to the console but otherwise continues execution with a type of empty matrix as the range result.

Link to comment
>> range=[]:1	Warning: Colon operands must be real scalars.	range =		Empty matrix: 1-by-0

Apparently, it prints a warning to the console but otherwise continues execution with a type of empty matrix as the range result.

I'm not sure if that is the result I want (a bug being ignored). But I think NI will improve the mathscript node step by step and eventually will cover these things.

Ton

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
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.