LVOOP: Objects sizes

Hello
I have few questions regarding LVOOP. I'll be refering to this whitepaper: http://www.ni.com/white-paper/3574/en, especially the part where it says:
LabVIEW allocates a single instance of the default value of the class. Any object that is the default value shares that pointer. This sharing means that if you have a very large array as the default value of your class there will initially only be one copy of that array in memory. When you write to an object’s data, if that object is currently sharing the default data pointer, LabVIEW duplicates the default value and then perform the write on the duplicate. Sharing the default instance makes the entire system use much less memory and makes opening a VI much faster.
Now, let's say I want to create class hierarchy, which is defining the behaviour of some other class (a Strategy pattern). No class in the hierarchy contain any mutable data, they're only redefining some methods. I've visualized this in the following picture:
Project with this VI is in the attachment.
So, here are the questions:
What is the size (in bytes) of LV Object? Whis question can be splitted into two: what is the size of actual object, which is stored somewhere in memory, and what is a size of a pointer to this object?
If I create class, which has no data, just some methods, what is the size of the object of this class? According to the whitepaper fragment above, there should be only one instance of this class in the whole application, and everything would point to it.Therefore the answer to this question would be exactly the same as the answer to question 1?
Folowing question 2: if the class methods are not reentrant, there is also one and only one instance of each in the whole memory?
And all of this leads in fact to single question: if I use such pattern, I only "pay" once for allocating all my "Worker" objects in memory, and then LV simply reuse them?
Solved!
Go to Solution.
Attachments:
ObjectSize.zip ‏100 KB

PiDi wrote:
So far I understood that if I don't mess with the class data in any way other that reading it*, LV won't create another instance of data for this class objects (at least on desktop, RT is my main concern now). And this is useful information, especially if I want to create hundreds, maybe thousands of objects of the same class in my application.
On desktop, you're correct. All the wires will point at the single default value.
On RT, the instances are independent, but that doesn't mean you're ever creating hundreds or thousands of the same object. If you created an array of 1000 objects, yes, you would have 1000 instances. But if you forked one object wire to two different accessor functions, and neither of them modified the object, they would both be sharing the same object.
Everything that follows is a rough guess because the LV compiler is at this point smarter than any human at doing this analysis and I reserve the right to yield to its computational superiority. I did not take the time to construct your example and put it under a debugger.
More important safety tip than that: Everything below is true only of LV 2012. The compiler and its optimization systems were massively different in 2009, slightly different in 2010, somewhat different in 2011, and should be vastly different in 2013.
In the picture shown:
When you first hit the run button, there are 4 objects on the block diagram, one in each of the four constants. The Action object has a worker object inside of it (its default value). I am ignoring anything on the front panel on the assumption that if you were using this in an application the panel would be closed.  Total: 5
After section A, there are 6 objects of each of the Worker classes (5 in the array and one in the constant) and 1 Action object (in the constant) and another worker object inside that. In this particular case, I think that toggling debugging has no effect on the count, but in many cases, any interim steps would evaporate when debugging is turned off. Total: 20.
Running B will copy each element of the array into the Action object, leaving the array behind. Shouldn't those objects be moved into the property node? No. LV leaves the array in place -- it is already allocated if this entire VI gets called a second time as a subVI. So you now have 34 worker objects and 16 Action objects. Total: 50
C is curious... C will not make any further copies of the Action objects as it runs, but because you used the Property Node, you're guaranteed to make a copy of the Worker object when you read it. Because the property VI will only conditionally fire based on the error cluster, the property VI forces a copy. An unconditional VI call may or may not make a copy, depending upon many many factors, but mostly depending upon what happens downstream. Since you say that the square region would be done inside a method of Action, put that inside an Inplace Element Structure and use the Unbundle/Bundle pair and you remove the guarantee that there will be a copy made. There might still be a copy depending upon what you do in that subVI, but the probability shifts in your favor. I can't think of a scenario where an unmodifiable object would be copied going into a local subVI call (even if the subVI is reentrant or dynamic dispatch) but the LV compiler might know of a case, so I won't rule it out -- there might be something involving UI thread priority or something weird that I haven't thought of.
BUT, there will only be one object at a time, so after the loop runs, there will only be 51 objects total -- that new one is the final copy made inside the loop which remains allocated. 50 if you switch out for an inplace element structure.
When you call this subroutine a second time, those allocations are already made, and they get reused. So assuming you use the inplace element structure, there is not a continuous memory bloat when you call this multiple times in succession -- your memory level holds dead flat.

Similar Messages

  • Are LVOOP Objects supported in TestStand 4.0?

    I'm working with a TestStand project and was thinking of using LVOOP Objects. I tried adding a Public Class VI from LabVIEW into a TestStand step but the object output shows up as Unknown in the type out. Does this mean that TestStand is ignorant of LVOOP objects?
    Edit: Just found this post:
    http://forums.ni.com/ni/board/message?board.id=330&message.id=14786&query.id=44052#M14786
    So that answers my question. This really sucks...!
    Message Edited by Michael Aivaliotis on 09-07-2007 07:53 PM
    Michael Aivaliotis
    VI Shots LLC

    Most of the time people do this in the Process Setup Callback and Process Cleanup Callback.  Those are process model callbacks that you can override from your client sequence.  They are probably better to use than the engine callbacks (SequenceFileUnload and SequenceFileLoad).  They get executed before and after the looping respectively.
    If you open the process model you'll see where they get called.  Process Setup Callback is in the Setup step group and Process Cleanup Callback is in the Cleanup step group.
    Regards,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to get OLAP cube objects size info?

    Hi,
    I am new at OLAP cube.
    I want to know OLAP Cube objects size information like VIEW.
    is any query to get size of Cube objects?
    Please help me out on this.
    Thank you,
    Nitin

    Nitin,
    This will give you some idea.
    *(1). Size of the whole AW:*
    select dbal.owner||'.'||substr(dbal.table_name,4) awname,
    to_char(round(sum(dbas.bytes)/1024/1024, 1), '999,999.9') as mb, dbas.tablespace_name, logging
    from   dba_lobs dbal, dba_segments dbas
    where  dbal.column_name = 'AWLOB' and dbal.segment_name = dbas.segment_name
    group by dbal.owner, dbal.table_name, dbas.tablespace_name, logging
    order by sum(dbas.bytes) desc
    *(2). Size of internal objects:*
    Each cube has an associated _STORED variable and a 'PXX' partition.
    _PRTCOMP is cube's partition's composite dimension.
    _AGGMAP  is the aggregation map that is used during aggregation of data.
    Replace table AW$BNSOLAP with the name of your AW table.
    select partname,
    round(sum(dbms_lob.getlength(awlob))/1024,0) KB
    from bawolap.aw$bnsolap
    where extnum = 0
    group by partname
    order by kb desc
    +;+

  • Got "java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size" Err

    System :jrockit-R27.4.0-jdk1.5.0_12
    4 GB RAM
    3GB Switch
    JVM Setting:
    <java classname="com.nomis.documentmgmt.scenario.OptBuildBaselineScript" fork="yes" failonerror="true" maxmemory="1536m">
    <jvmarg value="-client"/>
    <jvmarg value="-Djava.library.path=${dist.dir}/auxiliary/lib"/>
         <!--jvmarg value="-Xms128m"/-->
    <jvmarg value="-Xms1536m"/>
    <jvmarg value="–Xmx1536m"/>
    <jvmarg value="-XXcompactratio=100"/>
    <jvmarg value="-Xgc:genpar"/>
    <jvmarg value="-Xns:96m"/>
    <jvmarg value="-XXlargeObjectLimit:8192"/>
    <jvmarg value="-XXtlasize:16384"/>
    <jvmarg value="-XXgctrigger=5"/>
    Got Below error message
    [java] Exception in thread "Main Thread" java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size: 1333880, Num elements: 333465

    Looks like you are running out of memory allocating a large array.
    -- Henrik

  • Same object size (front panel) with different screen resolution

    Hi everybody,
    I realised an application, and I try to instal it on various computer. The probleme is that they haven't the same screen resolution, so the front panel is not the same on each computer. It is possible to build an application which have the same front panel with different screen resolution ?
    Kriss.

    Hi Krisss,
    switch off any "adapt to screen resolution" switches in the VI properties...
    You should also define "same front panel" and "same object size"! Do you mean the same pixel size or size in mm or size in percent of screen?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Howto determine Object size in memory?

    HI there!
    I know the JVM has a function which prints out a list of all obejcts currently instantiated with the object size and the number how many objects of this type are alive, but I dont know anymore howto enable this feature.
    My Profiler does not show this information :-(
    Any ideas?
    Thanks in advance, lgClemens

    Read in another thread that you coudl do like this:
      public static long calculateMemoryUsage(ObjectFactory factory) {
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        long mem0 = Runtime.getRuntime().totalMemory() -
          Runtime.getRuntime().freeMemory();
        Object handle = factory.makeObject();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        System.gc(); System.gc(); System.gc(); System.gc();
        long mem1 = Runtime.getRuntime().totalMemory() -
          Runtime.getRuntime().freeMemory();
        return mem1 - mem0;
    public interface ObjectFactory {
      public Object makeObject();
    }Gil

  • Applet Size/Object Size

    hello,
    why does the applet size / the object size when viewed in windows and linux is different. If the user uses Windows as the client PC the size is correct but when the same is viewed in Linux workstation its totally different. everything seems to be small. All the modules were created in windows but compiled and generated the fmx using linux and they are deployed in the linux server. Since the modules were developed in windows i understand there is some conflict with DPI and what we did was put a new parameter in the forwsweb.cfg and it worked. but that parameter has effect only if the browser is Internet Explorer. If i run the same using mozilla or firefox bcos linux workstation uses either mozilla or firefox. so what ever the values i specify for clientDPI no effect at all bcos the browser is not internet explorer. You might suggest me to develope everything in linux and set all the size there itself. But i cannot do that bcos we have more than 400 forms and developing or making changes is very very time consuming and its not practical for my situation.
    If you suggest me how to play around with the motiff settings in linux then I dont think the linux(fedora core1) is using those setting anymore.
    If any one can give me suggestions how to work around it that will be great.
    Thanks
    Blesson

    Blesson,
    is your client Linux, or the server. Linux as a client is not certified yet. For server issues, please contact customer support at metalink.oracle.com
    Frank

  • Object Size and Position values not being retained

    Hi,
           I'm trying to set the size and position of a picture object in a report. This logo, should appear on the top right corner of the report.
    The margins of the report are Left - .79 in, Right - 0.79 in, Top - 0.79 in and Bottom - 0.39 in.
    The size of the picture object should be 1.574 x 0.79 inches.
    I have ensured that File -> Page Setup -> dimensions are in INCHES.
    I right click the logo and select 'Size and Position'.
    I set 'Y' (distance between top of object and top margin) = 0. This is to perfectly align the object with the top margin.
    Now, i set the height of the object = 0.79 inches. Ok the dialog and close.
    The strange thing happening is, when i re-open the size and position dialog, i see that the values i set are not being retained.
    0.79 becomes 0.810
    and
    0 become -0.010.
    What am i doing wrong here? How can i make sure the values i specify in the size and position dialog are  retained.
    Thanks.

    Ensure File | Options | Layout tab has the following UNMARKED!!!!
    Design View
      Guidelines
      Grid
    Preview
      Guidelines
      Grid
    Ensure that "Snap to Grid" is turned off.
    Make your grid size larger (.5 inches for example)
    What is occurring (I suspect) is that your objects are snapping to the grid - thus changing the position and possibly size due to the Snap to Grid being turned on.

  • Is there any way to make Object size permanent in Pages?

    Hi. Does anyone know how to make the size of an object permanent? I use a lot of clip art and after resizing it, I would like it to stay that size but each time I select an object, the size selection box always appears. This is mainly a problem for Pages for the iPad.
    Appreciate any help

    Only if you have used a character style to italicise the words. If you have that you can change one of the word to a chosen colour and all words with that style will get the new colour

  • Regular selection tool cannot change object size

    I am using CS6.  When you create a simple square or any object, you will be able to use the regular selection tool to change the size by draggin on the "control point" around the object.
    However, I was able to do it before but I dun know why I can't do it suddenly.  The regular selection tool just enable me to move the image even I click on the "control point" on the object.  If I need to change the size, I need to use the resize tools which is a hassle.
    Anyone knows what happened?  Am I having some wrong setting in my AI ?

    View > Show Bounding Box

  • Find/Change object size width

    Hi guys,
    So this is the problem:
    I have over 900 pages long catalog and I made a little changes to a textframe options and other object styles, but bottomline is that now I have to change all the textframes width to 62 mm (its now 61 mm). I have tried the Find/Change "Object" options, but I just can't find the right way to do it. Is it even possible to do it with the Find/Change Object? I have to change over 6000 textframes manually if this dosen't work :/
    Do I have to do this with Grep scripting and how is that possbile if I have to do it with it?
    Thanks beforehand if you reply to this problem!

    Ha!
    I found the solution(ish), basically it's possible to change object dimensions with the "Find/Change Object". Thanks Bart Van de Wiele for the "Columns Fixed width" tip.
    ."Find Object Format" -> What kind of "Object style" you are looking for and then put "Text Frame Options" -> Width (exp. 55 mm)
    "Change Object Format" -> go to "Text Frame General Options" -> "Columns: Fixed width" -> width (exp. 56 mm, I have 3 mm inset spacing left&right so 56 + 6 is 62 mm).
    Change the desired textframes, BUT THEN you have this kind of problem where you can not change the textframes width sizes because they are "fixed sized".
    Click one of the changed textframes and go to "Style options" where you get that "+" -sign. Click in the options "Clear overrides".
    Now you have changed the all desired textframes and you can change the width too.

  • Find/Change object size

    We have a document where each page header/number needs to be changed to a different language. We can find change the text ok but when the text is changed the text box is too small. Unfortunately the headers are not on master pages and the colours vary depending on the background colour.
    How can we do a find/change for the size of the text box?
    We want a text box of size 5mm x 20mm to change to 5mm x 35mm, expanding to the right.
    As far as I can see there is no way to do this with the inbuilt find/change object. Any ideas?

    I think you're doing it a weird way, but who am I to criticise, I've done far weirder things.
    If you don't want to add this to the master page then that's fine, I think you'd be better off and it would make things easier in the long run.
    For changing the width of a frame you'd need a script to that, and I really cannot help you on that one, scripts are not my forté.

  • How to check the objects size in DBA_RECYCLEBIN

    Hi All,
    I want to purge dba_recyclebin, before that i want to check the size of all objects residing in dba_recyclebin.
    I am using below query to goup by tablespace.
    SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
    Kindly inform me is the correct way to check it. for example if the 10gb space is shown from this query, will i able to see 10GB free space after purging. Kindly confirm
    Thanks
    Krishna

    I am using below query to goup by tablespace.
    SELECT TS_NAME, SUM(SPACE*1024)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc
    As I mentioned, the SPACE field is in terms of BLOCKS rather than bytes.
    First confirm your database block size using
    SQL> show parameter db_block_size
    then modify the query as
    SQL> SELECT TS_NAME, SUM(SPACE*<DB_BLOCK_SIZE>)/1024/1024/1024 AS "Size in GB" FROM DBA_RECYCLEBIN GROUP BY TS_NAME order by 2 desc;
    I am quite sure the db_block_size in your database is 8192.
    Since you have used 1024 instead 8192 as the block size, you are seeing the difference in DBA_RECYCLEBIN and DBA_SEGMENTS

  • Custom OBJECT sizes and HTMLEditorKit

    Hi there all, I have a fairly tricky problem that I'm in a rush to get fixed.
    I need to know how to get a TextComponent (JTextArea etc) to wrap when being displayed as part of a web page in a JEditorKit.
    Don't worry, I'm not writing a HTML editor, but am using HTML as a template for a report with the OBJECT tag being the point where the application inserts custom components. The problem I'm having is that when using JTextArea as one of these components the text doesnt want to wrap and just stays on one line. I tracked the problem to a preferredSize issue and the underlying layout not forcing sizing constraints on the text component, letting it just carry on, on the same line.
    If anyone knows how to get the component to take its width from the parent component but specify its own height, help would be much appreciated.
    Also on a similar note, the ideal solution to this would be to not to use Components at all but override the existing ParagraphView in the text.html package, but I need these View components to be able to show menus and things, which is why I opted for the Component aproach. If anyone knows of an easy way to get these Views to accept events then I think this would be preferable.
    Hope that all makes sense :o)
    Example:
    <html>
       <head/>
       <body>
          <table width="100%">
             <tr><td>Created by <object classid="companyLogo" /></td></tr>
             <tr><td><object classid="companyMotto" /></td></tr>
             <!-- Some other stuff -->
          </table>
       </body>
    </html>This template will display (in a JEditorPane) a table with the text "Created by " then the application will insert an image (the company logo), then the EditorKit will insert another row and the application inserts the company motto. But if the company motto is long then i want it to wrap onto another line, but instead it will just keep going off the edge of the page.
    NOTE I am setting all sizes (pref, min and max) of the JEditorPane and it stays the same size but the text just carries on past the boundry and doesn't get painted.
    Thanks for any help in advance.
    deej

    I fixed the problem, i forgot to put the setLineWrap(true) in there :$ oops. Found an interesting bug tho. Given the HTML :
    <html><head /><body>
       <table width="100%">
          <tr><td>some text</td><td width="100%">some more text</td></tr>
          <tr><td colspan="2"><object classid="paragraph" /></td></tr>
       </table></body>
    </html>I get a wierd resizing problem where the JTextArea i use to display paragraph resizes itself until it has only one line and goes off the side of the page. The only way i found to fix it so far is to place the second row into its own table. Not sure where this bug lies but it was fairly surprising when it first happened.
    deej

  • Why does Photoshop randomly change Smart Object sizes when transforming?

    This has happened to me forever and every so often I ask to see if there's a solution. It seems like a bug.
    Here's the process.
    Select smart object (via panel or Move tool)
    Free Transform
    Select top left anchor (happens with any btw)
    Change measurements to desired size.
    Apply transformation
    Free Transform again
    Measurements are different than what was applied!
    I've again documented the process and am attaching all the images at the end.
    See specs & hardware:
    OSX 10.8.5
    PS CC 14.2.1 x64
    Magic Mouse.
    This also happens at home with
    OSX 10.9.3
    PS CC 14.2.1 x64
    Trackpad or USB mouse
    Notes:
    If rasterized this tends to not happen but that's not a solution because it takes away the advantage of Smart Objects.
    Image 6 is the second Free Transform.
    Any help is appreciated.

    It happens when you have transformed text.
    It's a widely discussed bug, that we've acknowledged and are testing a fix for.

Maybe you are looking for

  • TS3988 I am trying to set a new iCloud account up on my iPad  -  how do I delete my old account?

    I set up a new iTunes account for my family and want to apply it to our iPad.  Since the whole family uses it i want a seperate iTunes and iCloud account while keeping my old iTunes account dedicated to my iPhone and iPod only.  How can I remove my o

  • BPM processing error

    Hi I did a N;1 scenario with BPM. It's a three file to file scenario. The status in SXMB_MONI is fine and no errors. The com channels are all green and activated. However,  target directory is not created. How do I figure out where error has happened

  • How to setup my BIOS to boot my PC from any key on keyboard

    Can somebody tell me how and what to setup in BIOS (Neo2-FX with bios 1.b) to boot my PC from any key on keyboard? Only thing that I see in this bios is option "S3 wake up by PS2/Keyboard" but this didn't help me.

  • How can I change my security questions, all of them not just one

    I'm trying to change my security questions but when i recieve the email with the code I can only change one question and when I try to get into my idapple account they ask me for two questions and I dont have both. What can I do.?

  • HP Pavilion g6-1372sa, Windows 7 Home Premium - BD ROM

    This is the laptop that I just recently purchased and I'm just wondering, does it come with the ability to play Blu-Rays or not? I ask this because it says that there is a DVD drive and  BD Drive and yet I put a Blu Ray in and it didn't play it. I am