LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

(Out of memory) Error 2 occurred at Constructor Node w/ .NET assembly

Solved!
Go to solution

I am using GemBox.Spreadsheet to Build Excel Reports from my Test manager software. 

 

It works when I generate 8 small reports. (25kb xlsx file) , However when I try to generate 8 larger reports (60kb), I will get 4 perfectly fine reports, and then I get the error (Error 2 occurred at Constructor Node) where I'm trying to create an excelfile .NET object, the remaining 4 reports fail to generate.

 

I am only generating one report at a time, and after I finish I close the references to the .NET objects I have created.

 

I'm quite positive I am in fact not out of memory.

 

Is there a way to debug this further? Or Does this sound familiar? 

0 Kudos
Message 1 of 8
(3,739 Views)

So i figured out something. Its not starting with the Error 2.

 

So first i create an object.

 

Start.png

 

So this is what i get, Notice the type being an excel file. This is very nice.

Finish.png

 

Why did my ExcelFile refrence turn NULL?

0 Kudos
Message 2 of 8
(3,719 Views)
Solution
Accepted by topic author Taylorh140

I beleive i have found a solution.

 

When changing properties of objects i neglected to close refrences.

 

I imagine that there is a limited number of refrence labview is able to keep track of. 

 

here is a good place to look http://detritus.blogs.com/lycangeek/2006/05/how_to_say_good.html

0 Kudos
Message 3 of 8
(3,712 Views)

Indeed there is a limit. LabVIEW has a limit of 2^20 (-1) references of any one particular type, .NET in this case. See this Knowledge Article for details. See also this post for a more practical example. These were helpful to me as I searched for a solution to the Error 2 issue. Seems like LabVIEW should have a specific error for "Exceeded maximum number of references of this type" or something.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 4 of 8
(2,554 Views)

@rwunderl wrote:

.... Seems like LabVIEW should have a specific error for "Exceeded maximum number of references of this type" or something.


I agree, but it might lead you to the correct conclusion a bit too quickly. And with behavior as consistent as 1048575 + 1 references cause an error. it might be nice to know. One think that I do not know is how (Haven't taken the time to check) references can be open. Is a .net invoke node opening a reference (.net iterators, etc..), I wish Labview was a bit more verbose in informing when these limited resources are being used.

 

Perhaps it would be good to show what the current count is so you can tell if you have a memory leak. there is some work to be done here.

0 Kudos
Message 5 of 8
(2,539 Views)

I don't know if I would worry about finding a bug too quickly. But to your point, it would be nice to better understand when new references have been created.

 

Take this case:

DrawLines Some Refs Closed.png

 

Do you close the "points" refs coming out of the DrawLines method? Aren't they the same as the ones going in? Apparently not...

 

According to this post from Lycangeek, you generally do not need to close references to things that never get a wire. However, I found immediately that these unhandled references were giving me Error 2 issues.

 

You have to do the following to solve the issue:

DrawLines All Refs Closed.png

 

Since it doesn't hurt to close invalid references, but it could hurt to not close some references, I think the solution is to conservatively close all references that you [might] have created just as soon as you don't need them anymore.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 6 of 8
(2,524 Views)

@rwunderl wrote:

...LabVIEW should have a specific error for "Exceeded maximum number of references of this type" or something.


Just as a follow-up, I find Error 2 misleading because I'm NOT out of memory! What I have done is run out of space for LabVIEW to store references to objects. That is not memory. If I see Error 2, I want to see my [32-bit] application taking > 1 GB of memory. I find it misleading to see Error 2 when my application is only using 160 MB of memory.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 7 of 8
(2,521 Views)

@rwunderl wrote:

@rwunderl wrote:

...LabVIEW should have a specific error for "Exceeded maximum number of references of this type" or something.


Just as a follow-up, I find Error 2 misleading because I'm NOT out of memory! What I have done is run out of space for LabVIEW to store references to objects. That is not memory. If I see Error 2, I want to see my [32-bit] application taking > 1 GB of memory. I find it misleading to see Error 2 when my application is only using 160 MB of memory.


Well you are running out of memory, just not system memory.

It's like saying at the store "but i have money, i have 14 bitcoins at home!" 🙂

It's quite possible this is a Windows/.NET problem and LV isn't even available to tell if the memory it asks for and fails to get (the new reference slot) is due to general or specific memory limitations. I can't think of any situation where you would need 1 million+ active references. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(2,517 Views)