Buffer allocation in functional variable is driving me crazy

Hello,
I have a functional variable that holds 16 waveforms. Theses waveforms will be growing in time. For more memory efficency, I'm trying to use preallocation of the data arrays (let's say 300000 doubles).
But it looks like there is a new buffer allocation at the shift register and  this is slowing my application big time.
Since i'm pre-allocating and using inplace structure, I don't see why LabVIEW is doing a duplication of all the waveforms. 
Any idea to acheive an efficient functional variable?
Here are the code of my functional variable.
Thanks in advance!
Vincent
Solved!
Go to Solution.

I don't think that buffer allocation dot is your problem. That will appear on any uninitialized shift register, and is just LV's way of telling you it's going to store data there.
To improve performance I would add a new case called Get Data that outputs the waveform buffer, rather than having the shift register wired directly to an output indicator. That just forces LV to make a copy of the whole buffer every time this FG is called, even just to write or initialize data. The Get Data case would fork the shift register wire and send it to an output. Select the Use Default Value option for this output for this output terminal, so that the other cases (writing, initializing, etc.) just output an empty array of waveforms, which LV can do very efficiently.
Jarrod S.
National Instruments

Similar Messages

  • Reduce the number of Buffer Allocations

    Is there an easy way to find and reduce the number of Buffer Allocations in a LabVIEW application?
    Let me give you some background onto my approach before getting into my issues:  I create a waveform and send it to a PXI-6552 for generation.  At the same time that it outputs this waveform, it is also acquiring another waveform.  I process this acquired waveform's information and then save it to disk.  This loops over and over.
    I want to run this VI for periods of time AT LEAST equal to 24 hours.  (Maybe longer!)
    I know that you can't really control memory management much in LabVIEW, but is there a way to reduce the number of allocations between iterations?  Or, at least, free up some memory between for-loop iterations? 
    When I use the Profile >> Show Buffer Allocations, it seems like everything and their sister VIs all blink with dots.  :/ 
    I would prefer not to run the Memory Profiler and my application for 24 straight hours to examine its memory management and potential to crash.  There has to be a better way to go about this.
    The common places I find these Buffer Allocations are:
    Constants initialized in the loop
    Number to Fractional String VI
    Pretty much every subVI input/output pin
    NI HSDIO functions
    Build array function
    Every numeric multiplication/division function
    Every comparison AND, OR, equal to, etc.
    Am I really, really bad at LabVIEW memory management, or is there something obvious I am missing?  Please help me out   I cannot find much literature on the subject aside from "use the profile tools".
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

    That was very informative.
     I also stumbled upon this by jumping from link to link in the help documents http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/vi_memory_usage/.  So I am reading through this now!
    I also considered running it on a more microscopic scale just to see how rapidly the memory will grow.  It still might be worthwhile to test.
    My question about the "buffers":
    In a textual programming language, I believe I could re-use almost all of the allocated memory without duplication.  Is there a way to analyze the code to check where or if new memory is being allocated?  And is it possible to enforce a waveform data type (I believe its just a cluster) of size X to be over written next iteration by the new waveform data type also of size X?  Or do you believe this might already be happening?
    EDIT:
    I cannot release actual code due to Company policies, but I am using the following general set-up:
    Create a relatively simple I2C waveform using the I2C Waveform Reference Library.  This is passed through a tunnel to the while loop.  I also pass a reference to the NI HSDIO generation and acquisition channels and an error cluster via tunnels as well.
    Within the actual loop, I use the NI HSDIO to send the same waveform every iteration to the PXI.  I use NI HSDIO Fetch Waveform to return a DWDT (digital waveform data type) which is the same size as the original waveform but naturally with different elements.
    I post process this DWDT by converting it to boolean with Digital to Boolean Array VI, a few build arrays, array transpose'es, and comparsion functions.
    Lastly I convert this boolean array into a string of 0's and 1's and then substrings from this string.  (Around 10 per iteration).  These 10 substrings are converted to decimal numbers which are built into an array that is saved to disk with Write Spreadsheet to File .
    I do not use any shift registers or anything.  It contains no inner loops but does use an inner case structure.
    I do not suspect any large allocations before or after this main loop either.
    I also do not have any front panel objects (except for the file path Contol, but this could be set to be a constant if need be.)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • Reason: Error in sieve filter: Unknown function/variable found: church around input line 79 [ stop; } require " f^ileinto"; if header ]

    My wife's email has been getting filled with hundereds of emails with this in them this morning. I don't see where anyone else is having this problem today, but I wanted to see if it's on iCloud's end or ours.
    Processing errors occurred during delivery:
    Recipient address: [email protected]
    Reason: Error in sieve filter: Unknown function/variable found: church around input line 79 [ stop; } require " f^ileinto"; if header ]
    Delivery processing continued in spite of these errors.
    Reporting-MTA: dns;ms21034.mac.com (tcp_intranet-daemon)
    Arrival-date: Tue, 13 Mar 2012 07:33:18 +0000 (GMT)

    My Wife and I both have an Ipad and an iPhone, I use an iMac and my wife a MacBook Pro.
    I have this problem with all my devices.
    My wife has NOT got this problem.
    We both use a [email protected] email acount.
    Just compared the settings:
    For "Incoming server" I have p03-imap.mail.me.com
    My Wife has p02-imap.mail.me.com .... and has not got this problem.
    I have setup a new rule for incoming mails (for the meantime):
    move all incoming emails from [email protected] to trash and delete it.
    Works fine for now,......until APPLE deals with the problem.
    Message was edited by: RTONLINE

  • Function call another function variable

    Is it possible to call another function variable?
    Below is my Script:
    f2();
    function f1() { 
      var v2 = 1; 
    function f2(v2) { 
      var v3= 2; 
      alert(v2);

    Hi creativejoan0425,
    Some additional notes:
    > Is it possible to call access another function variable?
    No, it isn't. A local variable only lives in the scope of the function (body) where it is declared. In that sense any local variable should be considered private—in OOP terms.
    pixxxel schubser's solution is based on setting a global scope for the variable myA, so it is visible from every place of your code.
    Another solution could be implemented using JS closure mechanism. You can create a local scope (in an anonymous function which is executed once) then return your main function and additional helpers from that scope. All inner functions have then access to the local variables that have been declared in the scope. For example, you can create your function f1 and attach a getter function to it, as follows:
    var f1 = (function(/*anonymous*/__)
        // Local variable to be nested in the closure
        var v1;
        (__ = function(/*optional init value*/x)
            // Here is your *actual* function
            // do what you want with v1
            v1 = 'undefined'!=typeof x ? x : Math.random();
        ).getVar = function()
            // Here is your getter
            return v1;
        return __;
    var f2 = function()
        alert( f1.getVar() );
    // Process
    f1('init');
    f2();           // => 'init'
    f1();
    f2();           // => some random number
    f1();
    f2();           // => another random number
    // etc
    This way v1 remains almost private but the outer code can read it through f1.getVar().
    Anyway this seems to me a complicate approach for a basic script that probably does not require high security level. Another option, really easy to set up, is to use the fact that a function is an object. Instead of declaring a local variable, just handle v1 as a (public) member of f1, as follows:
    var f1 = function F(/*optional init*/x)
        // Do something with F.var
        F.v1 = 'undefined'!=typeof x ? x : Math.random();
    var f2 = function()
        alert( f1.v1 );
    f1('init');
    f2();          // => 'init'
    f1();
    f2();          // => some random number
    f1();
    f2();          // => another random number
    That's it!
    > why every function need to return?
    No, return is not required. By default, any function that has no return statement will simply return undefined.
    @+
    Marc

  • Spinning beach ball of death - Error when running Chrome - kernel: IOSurface: buffer allocation size is zero

    I get the following error when running Chrome v18.0.1025.163 on my MacBook Pro with MacOS 10.7.3
    kernel: IOSurface: buffer allocation size is zero
    I have had many tabs crash, then it crashes the Chrome application, then quickly making my entire Mac unresponsive with a spinning beach ball of death.  I am not sure if it is Chrome or not, as I tend to do most of my work these days in a browser. 
    Have others seen this?  Is there a fix?  What can I do to stop these crashes?

    As far as I've been able to discover, this bug is specific to WebKit browsers running (Chrome and Safari are based on WebKit).  Perhaps it is related to those browsers running plugins (like Flash) and using an IOSurface to pass the rendering data back from the plugin.  This issue was constant on my late 2010 MBP and would freeze the machine entirely once a day.  Having switched to using Firefox or Opera I no longer see ANY messages for "IOSurface: Buffer allocation size is zero".  Thankfully, this also comes without any more freezing when time machine starts up or at any other time.
    It looks like there are a lot of changes going on in WebKit relating to IOSurface usage (http://svnsearch.org/svnsearch/repos/WEBKIT/search?logMessage=iosurface).  Hopefully this will be fixed very soon.

  • Mac OSX Player Issue: kernel: IOSurface: buffer allocation size is zero.

    We posted a blog entry trying to investigate the Console.app error log messages that appear when using the Adobe Flash Player on OSX (32bit and 64bit affected, 10.7 Lion, Player version 10.3 and 11.0).
    find our Blog entry here: http://www.nanofunk.net/mac-osx-lion-10-7-system-freezes-kernel-iosurface-buffer-allocatio n-size-is-zero-console-message/
    The Message that appears is
    kernel: IOSurface: buffer allocation size is zero
    To reproduce the issue, use this steps
    click on "Clear Display" in Console.app
    go to http://www.adobe.com/software/flash/about/ and the error will show up in the console.
    Sometimes, this freezes the whole OSX system, with a spinning beachball for at least 20seconds, up to five minutes.
    This is inacceptable. We are hoping to hear back from Apple or Adobe ASAP.
    Please try to reproduce this on your OSX installation and post the results to this thread.
    thanks,
    nanofunk.net

    As far as I've been able to discover, this bug is specific to WebKit browsers running (Chrome and Safari are based on WebKit).  Perhaps it is related to those browsers running plugins (like Flash) and using an IOSurface to pass the rendering data back from the plugin.  This issue was constant on my late 2010 MBP and would freeze the machine entirely once a day.  Having switched to using Firefox or Opera I no longer see ANY messages for "IOSurface: Buffer allocation size is zero".  Thankfully, this also comes without any more freezing when time machine starts up or at any other time.
    It looks like there are a lot of changes going on in WebKit relating to IOSurface usage (http://svnsearch.org/svnsearch/repos/WEBKIT/search?logMessage=iosurface).  Hopefully this will be fixed very soon.

  • BEX function variable

    Hi Experts,
    Does anyone know if it is possible to save a KF value into a function variable (both in the same Query), so we can play with the KF value in the user exit?
    Thanks
    Regards,
    Albert

    Hey!
    Maybe it helps you to know that you could have a formula variable. You can calculate this value over an exit and calculate in this formula whatever you want with other key figures.
    Best regards,
    Peter

  • Buffer allocation on a 3750

    Hi guys,
    A question that pertains to the 3750 : regarding unused interfaces or even shutdown interfaces is there any buffer allocated / reserved for such interfaces ?
    If I recall correctly, independently from the queue-set settings, each queue of an interface will be reserved at least 16 buffers. However if the interface is not used (not even configured) or if the interface is actually shut down, does such allocation still hold ? Or will the said buffers be returned to the common buffer pool ?
    Thanks for any input.

    I've wondered the same, but I haven't found any documentation to says one way or the other.

  • Errors driving me crazy! But, it all compiles fine

    Errors driving me crazy! although compiles fine
    I am working on a project for an online class - I am teaching myself really! My last assignment I cannot get to work. I had a friend who "knows" what he is doing help me. Well that didn't work out too well, my class is a beginner and he put stuff in that I never used yet. I am using Jgrasp and Eclipse. I really am trying but, there really is no teacher with this online class. I can't get questions answered in time and stuff goes past due. I am getting this error:
    Exception in thread "main" java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader .java:55)
    at java.util.Scanner.<init>(Scanner.java:590)
    at ttest.main(ttest.java:54)
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.
    This is my code:
    import java.util.*;
    import java.io.*;
    public class ttest
    static Scanner console = new Scanner(System.in);
    public static void main(String[] args)throws IOException
    FileInputStream fin = null; // input file reference
    PrintStream floser = null; // output file references
    PrintStream fwinner = null;
    Scanner rs; // record scanner
    Scanner ls; // line scanner
    String inputrec; // full record buffer
    int wins; // data read from each record
    int losses;
    double pctg;
    String team;
    String best = null; // track best/worst team(s)
    String worst = null;
    double worst_pctg = 2.0; // track best/worst pctgs
    double best_pctg = -1.0;
    int winner_count = 0; // counters for winning/losing records
    int loser_count = 0;
    // should check args.length and if not == 1 generate error
    try
    Scanner inFile = new Scanner(new FileReader("football.txt"));
    catch( FileNotFoundException e )
    System.exit( 1 );
    try
    floser = new PrintStream( new FileOutputStream( "loser.txt" ) );
    fwinner = new PrintStream( new FileOutputStream( "winner.txt" ) );
    catch( FileNotFoundException e )
    System.out.printf( "unable to open an output file: %s\n", e.toString() );
    System.exit( 1 );
    try
    rs = new Scanner( fin );
    while( rs.hasNext( ) )
    inputrec = rs.nextLine( ); /* read next line */
    ls = new Scanner( inputrec ); /* prevents stumble if record has more than expected */
    team = ls.next( );
    wins = ls.nextInt();
    losses = ls.nextInt();
    if( wins + losses > 0 )
    pctg = ((double) wins)/(wins + losses);
    else
    pctg = 0.0;
    if( pctg > .5 )
    if( pctg > best_pctg )
    best_pctg = pctg;
    best = team;
    else
    if( pctg == best_pctg )
    best += ", " + team;
    fwinner.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    winner_count++;
    else
    if( pctg < worst_pctg )
    worst_pctg = pctg;
    worst = team;
    else
    if( pctg == worst_pctg )
    worst += ", " + team;
    floser.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    loser_count++;
    fin.close( );
    floser.close( );
    fwinner.close( );
    catch( IOException e ) {
    System.out.printf( "I/O error: %s\n", e.toString() );
    System.exit( 1 );
    System.out.printf( "%d teams have winning records; %d teams have losing records\n", winner_count, loser_count );
    System.out.printf( "Team(s) with best percentage: %5.3f %s\n", best_pctg, best );
    System.out.printf( "Team(s) with worst percentage: %5.3f %s\n", worst_pctg, worst );
    The assignment is:
    Create a Java program to read in an unknown number of lines from a data file. You will need to create the data file. The contents of the file can be found at the bottom of this document. This file contains a football team's name, the number of games they have won, and the number of games they have lost.
    Your program should accomplish the following tasks:
    1. Process all data until it reaches the end-of-file. Calculate the win percentage for each team.
    2. Output to a file ("top.txt") a listing of all teams with a win percentage greater than .500. This file should contain the team name and the win percentage.
    3. Output to a file ("bottom.txt") a listing of all teams with a win percentage of .500 or lower. This file should contain the team name and the win percentage.
    4. Count and print to the screen the number of teams with a record greater then .500 and the number of teams with a record of .500 and below, each appropriately labeled.
    5. Output in a message box: the team with the highest win percentage and the team with the lowest win percentage, each appropriately labeled. If there is a tie for the highest win percentage or a tie for the lowest win percentage, you must output all of the teams.
    Dallas 5 2
    Philadelphia 4 3
    Washington 3 4
    NY_Giants 3 4
    Minnesota 6 1
    Green_Bay 3 4

    If you are working in Eclipse IDE, you can set a breakpoint and single step through your code to determe what line crashes. You can also examine variable values before the crash. Locate a line before the crash and set a breakpoint by double clicking on the vertical blue line that appears immediately to the left of the line of code. A blue 'dot' will appear on the line. Then,from the menu, select 'debug as application'. This will run your main() function up to that break point. In the menu, there are icons to allow you to single step through lines of code from that point, and another icon to step over lines of code if you want.
    Alternatively to setting break points, you can sprinkle your code with piles of System.out.println statements. Example: you have System.out.println("1"), and in another part of your code System.out.println("2"). If you code runs and prints out "1", but not "2", then you code crashed between them. I use breakpoints and System.out.println to debug.
    In your trace, you have "at java.util.Scanner.<init>(Scanner.java:590)" which means it crashed at line 590 (note in all the tracings, Scanner.java is a name of one of your custom classes and not a vendor class, thats how you can quickly find what part of the trace is important to you).
    NullPointerException means you tried to call a function on an object that is not instansiated (its null).
    Example: person.getName() will not work if person is null. Its the call to getName() that crashes.
    Debugging code is a very important skill set that you have to develop in which you have to logically track down and isolate problems.

  • Transformation problems driving me crazy

    This is driving me crazy! If I create a process with a start node that
    receives an typed XML document (schema has compiled OK in the utilities
    project) then if I try to use a transformation to bind a String element from
    the expected send XML to a String variable, then I just get the following
    message in a red box:
    ERROR: cannot find a suitable Constraint for this join link.
    Any clues as to what I'm doing wrong gratefully received.
    I'm using WLI 9.2.
    Cheers,
    SB

    I can get around this by manually modifying the .xq file that is created
    (but not populated with my query) to include
    the xquery mapping that I want, and it works fine. I still can't fathom out
    why the xquery transformation utility comes
    up with the error below.
    SB
    "Stanley Beamish" <[email protected]> wrote in message
    news:[email protected]..
    This is driving me crazy! If I create a process with a start node that
    receives an typed XML document (schema has compiled OK in the utilities
    project) then if I try to use a transformation to bind a String element from
    the expected send XML to a String variable, then I just get the following
    message in a red box:
    ERROR: cannot find a suitable Constraint for this join link.
    Any clues as to what I'm doing wrong gratefully received.
    I'm using WLI 9.2.
    Cheers,
    SB

  • My 710 is driving me crazy!

    Barely touch the screen with your cheek and calls are either muted or put on hold.  This is driving me crazy.  I've had other touch screen phones and this has never happened. It's because the screen goes automatically to this the screen with these choices.  Any ideas?
    Solved!
    Go to Solution.

    Hi geodavky,
    thanks for posting and welcome to the forum.
    Please check whether the proximity sensor on your Lumia 710 is working. This sensor should blank the screen and deactivate touch when you move the phone to your ear.
    You can verify the function of this sensor by opening the diagnostic tool, dial ##634#, and choose the proximity test. You will see a yellow circle which will turn green when you move your finger over the sensor which is to the left of the earpiece on the front.
    If the circle does not run green please visit a Nokia Care Point to have your Lumia 710 examined.
    Hope this helps,
    Kosh
    Press the 'Accept As Solution' icon if I have solved your problem, click on the Star Icon below if my advice has helped you!

  • My i tunes won't open. i keep getting error7 (windows error 193) . contacted microsoft(thought it was a windows thing...not) have uninstalled itunes and everything related to it ,re installed and message still comes up. Help please,driving me crazy.

    help. my iTunes wont open. I keep getting the message error7 (windows error 193). contacted Microsoft they said contact iTunes support. I have uninstalled all iTunes componets and then reinstalled everything but message still comes up... its driving me crazy.

    If it's a Windows error, it's typically going to be a Microsoft problem. Uninstall any security software you have and if you have a restore point for your PC, you may want to restore your PC back to when iTunes was working normally. If none of those work you would need to contact Microsoft and demand help.

  • How do I stop iTunes from automatically sorting by Album Artist?  Driving me crazy.

    How do I stop iTunes from automatically sorting by Album Artist?  Driving me crazy.
    I listen to primarily classical music
    All of my music was very deliberatley titled by composers "Last Name, First Name" as the artist.
    iTunes is changing it to the Album Artist.  I have to go in and delete that information - AND THEN IT LATER REVERTS IT BACK!!!
    Hours have been wasted and I am feeling so ticked.
    Any help?

    Purchased or ripped media?
    If these are ripped mp3s then another possibility is multiple embedded tags. iTunes works best with a single ID3v2.3 tag. Some software creates both an ID3v1.0 and IDv2.x tag. With multiple tags it is not certain which iTunes reads or which it updates, and any device may choose differently. Once songs have the correct info. in iTunes you can use Convert ID3 Tags... None several times, then Convert ID3 Tags... v2.3. The process removes any embedded art but otherwise preserves the data that iTunes knows. You could use my script CreateFolderArt before and after to save and then restore the artwork.
    In the long run you may be better off populating Album Artist properly with a copy of whatever is currently in Artist. My script CopyArtistToAlbumArtist can do this effectively.
    tt2

  • I've added to ios6 to my new ipod touch with no problems. I'm trying to now restore the factory settings but the screen is frozen with an itunes sign and lead pointing towards it. The ipod won't even switch off. Can anyone help as it's driving me crazy

    I've added ios6 to my new ipod but tried then to restore the factory settings. It won't extract any settings and the itunes then tells me that the server cannot be reached or is unavailable. I've been trying all day. Now the ipod has a itunes sign and a computer lead pointing towards it on the screen and this is frozen. It won't switch off or do anything else. Any ideas as this is now driving me crazy.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • I can no longer back up my iphone to my computer on selecting 'sync'. I can back up to iCloud but I get an error message telling me I cannot backup to my Mac. Can any one help? It's driving me crazy!

    I can no longer back up my iphone to my computer on selecting 'sync'. I can back up to iCloud but I get an error message telling me I cannot backup to my Mac. Can any one help? It's driving me crazy!

    Hello joelfromn. charleston,
    It seems you are unable to activate iMessage on a device with no carrier service. The following article provides information regarding activation issues:
    If you get an error when trying to activate iMessage or FaceTime - Apple Support
    Check your device settings
    Make sure that you’re connected to a cellular data or Wi-Fi network. If you're using an iPhone, you'll need SMS messaging to activate your phone number with iMessage and FaceTime. Depending on your carrier, you might be charged for this SMS.
    Go to Settings > General > Date & Time and make sure that your time zone is set up correctly.
    Thank you for contributing to Apple Support Communities.
    Cheers,
    Bobby_D

Maybe you are looking for

  • Error running ssodatax script for partner applications

    I am running the ssodatax script after creating a partner application using the user interface in the portal. I get the following error after the script starts running: SP2-0310: unable to open file "sso/ssoseedp.sql" Any thoughts will be appreciated

  • LG Ally - sending text message with pic AND audio *2 attachments on one message*

    I can send an audio file via text message... I can send a picture via text message but for the life of me I CANNOT figure out how to send a pic with audio via text message and it's driving me crazy! Does anyone know how to do this?

  • How do I install Front Row for my MacBook Air with Lion OS

    I need to know how to simply install Front Row onto my MacBook Air with Lion OX 10.7.4. Please help.

  • Modifying Photoshop menus via a plugin

    Hi, I'm new to Photoshop plugin development so forgive me if this is a common question. I'm using the Photoshop CS Version 8.0 SDK of 10/20/2003 under Windows 2000. Photoshop offers the basic menu set 'File Edit Image..Help' - can a plugin add its ow

  • Help! Lost Profile?

    Had the G5 in storage while traveling for 6 months and could not remember my login password. I was able to rememeber my master reset and the computer created another profile. The G5 has created a new profile, and now I cannot find my old settings, ie