Find memory leakage when passing Object Reference from Teststand to vi

I am using Teststand to call labview vi, and pass ThisContext of sequence to vi as object reference, but if I just loop this step and I can find the memory using keep increasing, how can I avoid the memory leakage inside the vi.
see my vi, it is to post message to UI.
Solved!
Go to Solution.

You should be using a close reference node to close the references you get as a result of an invoke. In the code below you should be closing the references you get from the following:
AsPropertyObject
Thread
Close those two references once you are done with them.
Also make sure you turned off result collection in your sequence or you will be using up memory continually for the step results.
Hope this helps,
-Doug

Similar Messages

  • Pass object reference from TestStand to C#

    Hi,
    I have created a GUI in .NET which i invoke in TestStand (through a custom step type). User can enter a object reference teststand variable in the UI input expression box. So i need to get the object value in that variable and use it to call some .net functions. To get the values from expression box of UI and put in TestStand step variable i use:
             PropertyObject.SetValInterface("Step.TestStationObj", 0, tsexprTestStationObj.DisplayText.Trim()); To check the value in the step variable if i do:
             MessageBox.Show("TestStation obj after setting:",PropertyObject.GetValInterface("Step.TestStationObj",0).ToString());
    But i do not get any value. Guess it is null. Is this a correct way? My intension is to get the value corresponding to a teststand object reference and pass it to C#. The C# UI control is of type NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit

    Thanks Andy.
    I still get the error when i am trying to pass the object created from C# to Teststand. I have explained what i am trying to do. Kindly requesting your assitance on this issue.
    I have 2 classes in C# (code given below), I am trying to pass the object of "Counter" (c1) class from the "Mainfrm" to teststand. In teststand(counter.seq), I am trying to access the function "GetCount() and SetCount()". I have attached the snapshot of the error that i get from teststand.
    Class Counter
        private int count;
        public int GetCount ()
           return (count);
        public void SetCount(int _count)
           count = _count;
    Class Mainfrm : Form
        public Counter c1;
            private void Mainfrm (object sender, EventArgs e)
                InitializeComponent();
                axApplicationMgr1.Start();
                mEngine = axApplicationMgr1.GetEngine();
                currentFile = axApplicationMgr1.OpenSequenceFile(@"Counter.seq");
                pobj = mEngine.NewPropertyObject(NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Container, false, "", 0);
                pobj.NewSubProperty("Parameters.ObjRef1", NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Reference, false, "", 0);
                pobj.SetValInterface("Parameters.ObjRef1", 0, (object)c1);
                mExecution = mEngine.NewExecution(currentFile, "MainSequence", null, false, 0, pobj, null, null);
    Attachments:
    ErrorFromTestStand.JPG ‏28 KB

  • How to get caller object reference from a method

    Hi,
    I am working a already existing Java Swing project, now I got a problem, in a method I need to get the caller object reference otherwise, I can't succeed this operation. So please tell me a way how to get the caller object reference from a method. that method would be static or regular method anything will do for me.
    Edited by: navaneeth.j on Jan 29, 2010 11:20 PM

    navaneeth.j wrote:
    Actually my doubt is, I have a method "addition" method, which is using by many classes so my requirement is in the addition method I want to write a code snippet which will identify and get the the caller object. Actually I tried Reflection.getcallerclass but there I am getting "CLASS" object not the actual object reference, but I want object reference.
    Actually we have a huge project which is writen plain JAVA, so in this project the authors written the Database connection package for single database transaction. so now we are using this project source code for JSF application in this web application the DB package has serve based on the dynamic db connection parameters, so if we want to change this package fully means need to solve the dependency problem in hundreds of classes, so my point is if I can access the caller object in the DB package when ever it gets called by any class from any where of the project. So actually I liked Reflection.getcallerclass, the way of implementation perfectly works for me but it is not giving caller object reference, if something gives the caller object then I can get the DB connection parameters then there is no need to pass the parameters in the hierarchy.You can add a parameter (of type Object) to your addition() method
    and everywhere you call the addition() method also pass this (which from the POW of the addition() method will be a reference to the calling class instance).
    There may be alternative solutions
    but none that require less effort.

  • How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?

    How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
    I'm trying to control an ActiveX object (a Web Browser) from another VI and need to get the object reference programmatically. I can get the LabVIEW ActiveXContainer reference, but am lost on how to get the reference for the object _inside_ the container.

    Hi Lee,
    The reference to the container is actually also accessing the object inside the container. Use the Property Node and Invoke Node to access properties and launch methods for the object. I've attached a small example that passes the reference to a SubVI and invokes a method inside the SubVI.
    - Philip Courtois, Thinkbot Solutions
    Attachments:
    WebContainer.zip ‏21 KB

  • What is the use of passing object reference to itself ?

    What is the use of passing object reference to itself ?
    regards,
    namanc

    There is an use for returning an object reference from itself, for instance:
    class C {
    public:
         C append(C c) {
             // do something interesting here, and then:
             return this;
    }You can "chain" calls, like this:
    C c = new C();
    C d = new C();
    C e = new C();
    c.append (d).append (e);Maybe the OP has "inverted" the common usage, or thought about a static method of a class C that requires a parameter of type C (effectively being a sort of "non-static method").
    class C {
        static void doAnotherThing (C c) {
            c.doSomething(); //-- effectively C.doAnotherThing(c) is an "alternative syntax" for c.doSomething()

  • ExternalInterface: pass object reference across interface - how?

    I want to invoke methods on specific Javascript or
    ActionScript objects through calls across the ExternalInterface
    barrier. I would like to be able to do this either AS -> JS or
    JS -> AS.
    So I would like to pass an object reference across the
    interface. I'm not sure exactly what *is* getting passed (is it the
    serialized value of the object?), but it doesn't seem to work as an
    object reference.
    Here's a notional code sample. I have two symmetric object
    definitions, one in Javascript, one in ActionScript. During
    initialization, one instance of each object will be created and
    given a pointer to the other. Then they should each be able to
    invoke a method on the other to "do stuff".
    //----------[ code ]---------------------------------
    //--- Javascript ---
    class JSobj {
    var _asObj;
    JSobj.prototype.setASObj = function(obj) { _asObj = obj; }
    JSobj.prototype.callASObj = function(foo) {
    callASObjectMethod(_asObj, foo); } // does: _asObj.asMethod(foo);
    JSobj.prototype.jsMethod = function(bar) { /* do stuff */ }
    function callJSObjectMethod(obj, args) { obj.jsMethod(args);
    //--- ActionScript ---
    class ASobj {
    var _jsObj;
    public function set jsObj (obj:Object):void { _jsObj = obj;
    public function callJSObj (foo:Number):void {
    ExternalInterface.call("callJSObjectMethod", _jsObj, foo); } //
    does: _jsObj.jsMethod(foo);
    public function asMethod (bar:Number):void { /* do stuff */
    function callASObjectMethod (obj:Object, args) {
    obj.asMethod(args); }
    ExternalInterface.addCallback("callASObjectMethod",
    callASObjectMethod);
    //----------[ /code ]---------------------------------
    My workaround is to pass a uint as an opaque handle for the
    object, then resolve it when it is passed back. I'd rather pass a
    real reference if possible. Is there a way to pass object
    references between JS and AS?
    Thanks,
    -e-

    It's an object of a class that extends Object. I guess the answer is no then.
    Thanks for your answer

  • Line Chart: It is possible to get the object reference from a flash chart

    Hi Folks,
    hope you feel well ...
    I wan't to get the Object Reference from a Chart Flash Object using javascript in the HTML Header of a Apex Page.
    It's long time ago with Oracle/Java and so my skills are really shity :-)
    The Functionbody works, but the following error occurs: chart.refresh is not a function
    It is necessary to CAST it ? with the Class AnyChart.js ?
    After 5 hours i give up ^^ is this kind of object handling possible ? THX4HELP@ll
    Apex Page HTML Header
    <script type="text/javascript">
    function hideSID2()
    var chart = document.getElementById("*c7067437546726610*");
    chart.refresh();
    </script>
    HTML File at runtime:
    <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    width="1400"
    height="600"
    id="c7067437546726610"
    align="top"> ...

    If you are using adobe Flex Builder to develop SWF, please be sure using ExternalInterface class to expose the refresh() method.
    then you can should be able to call this method in Javascript.

  • Userexit or BADI to change service price when create PO reference from PR

    Hi,
    I need userexit or Badi to change the gross price ( ESLL-TBTWR ) when create PO reference from PR.  Currently , when I do this it will recalculate the gross price based on the service master and ignoring whatever the price put in PR.  Could anyone tell me userexit or Badi that would allow me to change the price when i create PO from PR via ME21N.
    Thanks,
    Gilbert

    Hi Gilbert,
    You can try using Function Exit EXIT_SAPLMLSP_030 of Enhancment SRVESLL.
    This Function Exit has ESLL data as changing parameter.
    But this Function Exit is called from a number of transaction. So do put in correct checks (like sy-tcode or sy-ucomm) before substituting any values. If proper checks are not put in then values may be substituted when this function exit is called from other transactions (like tcode "ML81N").
    Hope this will help.
    Regards,
    Abhisek.

  • Any Resources for Learning Object Reference in TestStand?

    Hi All,
    I have been using Active X servers in TestStand for several years and now some of the newer stuff I am being supplied with is Dot Net objects. Does anyone know of somewhere to learn the correct way to use object references in TestStand. I don't understand when you should create a new object  vs just using an existing object reference. I also would like to understand how to use an object reference variable.
    I looked at the TS examples, but there is not an explanation. 
    Any ideas?
    TIA,
    Jim

    Jim,
    You may try reading through the NI TestStand Advanced Architecture Series, specifically Chapter 2: Using the NI TestStand Object Model. These may shed some light on the issue.
    Regards,
    Steven Zittrower
    Applications Engineer
    National Instruments
    http://www.ni.com

  • Passing an ActiveX reference from TestStand to Labview

    How can I pass and ActiveX reference (for a dll) created and used in a TestStand sequence (under Locals) to a VI running within that sequence so that I can then call the same instance of the dll from Labview?
    (I know this isn't the best approach to programming but I'm more interested in proving the point than anything else)
    Cheers
    Dan

    Here's what I think you are tyring to do. Within your sequence, instantiate an object from an ActiveX DLL, storing a reference to it within a TS variable. Then, within a VI called by this sequence, call a method of the intantiated object.
    To do this, when specifying your module on your LV step you must check the Sequence Context ActiveX Pointer check box. In the called VI you must have the a Sequence Context control on your front panel and have it wired to your connector pane along with a TestData cluster control and a LV Error Out cluster control.
    Within the VI you use an invoke node to invoke the AsPropertyObject method on the SequenceContext (Make sure you use the ActiveX close function on this new reference when you are done with it.). Use another invoke node to call GetValInterface method on the sequence context property object reference (you could probably also use the GetValIDispatch method. See the help). For this invoke node you will want to use a lookupstring that reference the variable, relative to yo sequence context, in which you stored the refernce to the instantiated object in your sequence file. This will return a variant reference. You must convert this reference to a LV reference using the "To G Data" function in the ActiveX palette. The "To G Data" function requires a type input. You will need an ActiveX Automation Refnum control as the input to this (see ActiveX control palette). You will need to right click on this automation refnum control and browse the ActiveX automation server until you find the DLL ActiveX server from which you instantiated your object within your sequence. Once selected, also select the object that you instantiated. The "To G Data" function will then give you a reference to you object on which you can happily used in your desired manner. Make sure to close this reference with an ActiveX Automation close function when you are done with it.
    I would definitely clean this up with a subVI to perhaps generalize the solution.

  • How do you pass vi references from one event to another

    I have a vi which gets vi references (thereby loading the vi's into memory) for all the vi's in a given directory when a user clicks a button on the front panel. To do this I use an event structure. My question is whether it is possible to have another event (user button on the front panel) which unloads the vi's from memory. I have tried passing the vi references that are initially generated to the close reference function but whenever I do I get a 'vi reference invalid' error. Does this have to do with trying to pass the vi references between one event and another? If I use a local variable simply pass a reference to another indicator and then probe it, the originally-generated refnum and the local vari
    able refnum match up. However once I try to wire that same indicator to the close reference function I get the 'vi reference invalid' error. Is there a different/better way to unload the vi's from memory based on a user button click? Any suggestions would be welcome.
    Jason
    Attachments:
    Load_Directory_of_vi's.vi ‏57 KB

    Several problems with your code:
    1... Bad idea to use lights as buttons. Yes it can be done, but it's not "natural".
    2... If you've gotta do that, set their mechanical action to "LATCH WHEN RELEASED"
    3... Because of #2, you are getting TWO copies of every array when you click the LOAD VIs light (er... button).
    4... No need for the conversion from path to string and back - use BUILD PATH to append each file name to he folder path.
    5... Set the BROWSE OPTIONS on your PATH control to EXISTING DIRECTORY to allow browsing of directories, not files.
    6... Your code doesn't care whether the file is a .VI file, or a .ZIP file, or a .TXT file, or what. Use the PATTERN input on the LIST function to discriminate.
    7... Your code is only storing the latest refer
    ence, not the array of references.
    8... An ERROR DIALOG on the OPEN REFERENCE function will tell you that you're getting an error. Why? You are asking to prepare a non-reentrant VI for reentrant execution (why use options = 8?)
    9... Because of #8, the latest VI reference is invalid.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Passing object references to methods

    i got the Foo class a few minutes ago from the other forum, despite passing the object reference to the baz method, it prints "2" and not "3" at the end.
    but the Passer3 code seems to be different, "p" is passed to test() , and the changes to "pass" in the test method prints "silver 7".
    so i'm totally confused about the whole call by reference thing, can anyone explain?
    class Foo {
        public int bar = 0;
        public static void main(String[] args) {
                Foo foo = new Foo();
                foo.bar = 1;
                System.out.println(foo.bar);
                baz(foo);
                // if this was pass by reference the following line would print 3
                // but it doesn't, it prints 2
                System.out.println(foo.bar);
        private static void baz(Foo foo) {
            foo.bar = 2;
            foo = new Foo();
            foo.bar = 3;
    class Passer2 {
         String str;
         int i;
         Passer2(String str, int i) {
         this.str = str;
         this.i = i;
         void test(Passer2 pass) {
         pass.str = "silver";
         pass.i = 7;
    class Passer3 {
         public static void main(String[] args) {
         Passer2 p = new Passer2("gold", 5);
         System.out.println(p.str+" "+p.i);  //prints gold 5
         p.test(p);
         System.out.println(p.str+" "+p.i);   //prints silver 7
    }

    private static void baz(Foo foo) {
    foo.bar = 2;
    foo = new Foo();
    foo.bar = 3;This sets the bar variable in the object reference by
    foo to 2.
    It then creates a new Foo and references it by foo
    (foo is a copy of the passed reference and cannot be
    seen outside the method).
    It sets the bar variable of the newly created Foo to
    3 and then exits the method.
    The method's foo variable now no longer exists and
    now there is no longer any reference to the Foo
    created in the method.thanks, i think i followed what you said.
    so when i pass the object reference to the method, the parameter is a copy of that reference, and it can be pointed to a different object.
    is that correct?

  • Not enough memory error when passing an array to a chart

    Hello.
    I am trying to pass some data from a reading loop to a display loop using queues and charts.
    In order to save on redraws I am reading the queue just once a while, flush it and pass the resulting array to the Chart. It is actually an array with clusters of three values.
    Everything works fine unitl I actualy want to display the chart. I can pass the data and see it using an indicator without any problems.
    When I wire the data to the chart it randomly shows : "not enough memory to complete this operation"
    The fact is the array being passed to the chart is of random size.
    The queue size is good for about 20 min. Labview shows an error after a few seconds. After clicking ok it prints out the results correctly and then a second or two later same error.
    What am I missing here? Thanks
    LV 2012 f3 I7 2.4GHz 16GB RAM
    Attachments:
    TestChart.vi ‏17 KB

    Not sure if it helps or not but here is the error.
    I put about 200 elements/s in the queue. That is why instead of reading it 200/s I just want it to read it once a while.
    I am not sure what is a bigger burden:copying one 500 elements array twice a second or 200/s and 200 calls to the Queue.
    The max size of the queue is not important here. I can set it to something more reasonable and will get the same error.
    What will happen to my CPU usage if I put the Chart in the for loop and make 500 call to it? And then half a second later another 500 calls?
    As I said at this point I do not know how much history I need or not but all I want is to be able to see a few s of it. If I loose the rest it is ok for now. 
    Lets says that all I care is to see it close to real time with a history of 5s. It would mean the queue buffer size of  1000.
    Back to the main problem: why do I see the memory error  window when I know clearly that I have plenty of memory left.
    Attachments:
    Error.jpg ‏18 KB

  • Passing object references via methods

    Why is the JFrame object not being created in the following code:
    public class Main {
      public static void main(String[] args) {
        Main main = new Main();
        JFrame frame = null;
        main.createFrame(frame);  // <-- does not create the "frame" object
        frame.pack();
        frame.setVisible(true);
      private void createFrame(JFrame frame) {
        frame = new JFrame("createFrame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }Thanks.

    These explanations are great; real eye openers.
    OK. This could be a "way out in left field" question. I am just starting out with Java. But I want to ask:
    Objects are stored in the heap?
    Object references and primitives are stored on the stack?
    Adjusting heap size is straight-forward. A larger heap can store more/larger objects. What about stack sizes?
    C:\Dev\java -Xss1024k Main
    I assume this refers to method's stacks. But, what about object scoped, and class scoped, object references?
    public class Main {
      private static List list = new ArrayList(); // class scoped
      private JFrame frame = new JFrame();  // object scoped
      public static void main(String[] args) { ...... }
      private void createFrame() { .... }
    }How is the reference to list and frame stored, with regard to memory management?
    Do objects have stacks?
    Do classes have stacks?
    If not, how are the list and frame references stored (which helps me understand reference scoping).
    Would the overflow of a method stack (ex. via recurssion) also overflow the method's object and the method's class stacks?
    If these questions are stupid, "out of left field", don't matter, etc. Just ignore them.
    But the knowledge could help me avoid future memory related mistakes, and maybe pass a "Java Certified Developer" exam?
    My original question is already answered, so thanks to all.

  • How to find memory leakages in every screens and components in an Flex application ?

    Hi Guys,
    I was running my flex application and left it running over night.
    I noticed that it had a memory leakage issue. The memory leakage was huge upto 1.5gb
    Is there is way i can find out from where (which screen? and which component?) the memory is leaking in my application.??

    That's why FlashBuilder has a profiler.  There are some tips for use on my
    blog.
    Alex Harui
    Flex SDK Team
    Adobe System, Inc.
    http://blogs.adobe.com/aharui

Maybe you are looking for

  • Error while activating 0FIGL_O02 ODS

    Hi , It showing error while activating 0FIGL_O02 ODS .I have already allowed all special character "ALL_CAPITAL,.<>?/:;"{}[]||=-)(*&^%$#@!~`"'-_,ALL_CAPITAL_PLUS_HEX",but it's still showing error in particular field  0DOC_HD_TXT . Errror:Value 'AMITB

  • How can I move the photos I've made using my iPhone to my iTunes library and leave no copy on my iPhone?

    I am using an iPhone 3GS and iSO 6.1.3. My iPhone states the iSO software is "up to date" and will check for another version on Dec. 13, 2013. I have made photos using my iPhone 3GS and they are currently on my iPhone. I want to move them to my iTune

  • Flash player safe for mac

    it says i need flash player to play some games on my macbook pro. is flash player safe to use on my mac? or is there a setting of some sort i could change so i dont need to download flash player?

  • Colorblind users can't tell what apps are running

    There needs to be a setting under Dock Preferences to CHANGE THE COLOR of the dot under running applications in the Dock. I know the dot is there because I asked where the arrows went in the Apple Store and they told me it was there. After straining

  • Pop up in email

    I keep getting this popup when I try to see my email and it says "Cannot get email, server not responding". I am receiving and sending email but it is duplicated. This has become a nuisance and I will be going to Apple Store to let them look at it. D