G#

cancel
Showing results for 
Search instead for 
Did you mean: 

Serialize and Deserialize memory issue.

Hi everybody. Here is the code on g#, which fill ram with about 1gb. And I think the problem is with serialize method. I need your help.

0 Kudos
Message 1 of 7
(6,106 Views)

Hi Davkh,

I tried to repeat your problem, but can't see any problem. I don't get any strange memory issues at all. What versions of LabVIEW, OS and G# are you using?

Mattias

PS

Please notice that there were a fix in Deserialization of the G# Framework 1.4.5 release

From Release Notes:

G# Framework 1.4.5

G# 1.5.1

* Bugfix in Deserialize() for XML. Clusters were not correctly parsed. Removed support for non-matching XML structures.

* Removed XMLIgnoreList().

-----------------

0 Kudos
Message 2 of 7
(4,983 Views)

Please check test.vi. Put size to 10M. And some file path. When you run this vi, the 700mb ram memory is used and not cleared after the vi is finished.

0 Kudos
Message 3 of 7
(4,983 Views)

Hi,

Yes, I do see that LabVIEW increases memory. I do believe that LabVIEW is forced to create a lot of extra data copies. A known issues with LabVIEW. I do see one improvement I can do. In the serialization VI, please put a case structure around the "GetAggregatedObjects" VI as seen below. This is a very heavy recursive algorithm and is actually not need  if "include aggregates" isn't checked. Memory decrease a lot with this fix. In your code, please set "include aggregates" to FALSE. I will include this fix in the next release of G#.

SerializationFix.jpg

Another option you have if memory is a problem is not to use an array directly as a an G# attribute, but put a DVR references to the array instead. Then, you can actually override the serialize and deserialization in G# and create your own serializer/deserialize (the G#Object serializer VIs are dynamic dispatch). See the attached modified example called "Test_2.vi" with the TestClass2.lvclass. Notice that I also fixed the property that read the array.

I hope this help.

Thanks,

Mattias

Message was edited by: Mattias_Ericsson

Image was wrong. Here is the correct from the upcoming release.

0 Kudos
Message 4 of 7
(4,983 Views)

Could you please create for LV 2011. I'm using this version, so I can't open the project.

Thanks,

0 Kudos
Message 5 of 7
(4,983 Views)

Hi,

Oh, sorry. Here is a LV2011 version.

Mattias

0 Kudos
Message 6 of 7
(4,983 Views)

Thanks for interesting solution.

0 Kudos
Message 7 of 7
(4,983 Views)