Memory problem using visa serial functions in my vi

The last few days i created an application that reads data from one of
serial ports (contactless card reader). Today i noticed that my
application had crashed and Windows had displayed a message that my
system was low on virtual memory. I reset the system and i re-run the
application, having the task manager opened. I noticed that the memory
usage of my exe was taking more and more memory (starting from
21.520KB) as the seconds went by. In 5 minutes my app was using
25Mbytes! What i do in my application exactly, is opening the serial
port  then i enter the main while-loop, then every 2 seconds i read
from the  serial and write them to a tag.
I have used standard visa serial functions of Labview. When I trace my
application and simultaneously run TASKManager of windows to see the
memory, I saw that after running every Visa function memory usage goes
up!!!
what must I do? Please help me to overcome this problem.
Thanks,
M.Naghipourfar

Trust me, people use serial communication with LV all the time without losing memory. I can't check the example at the moment, but If it had a problem someone would have caught on to it by now. In any case, even if using the serial VIs causes the memory usage to go up, it shouldn't be dramatic, definitely not enough to crash the application and consume all memory.
Like I said, post your code (there is an attachment field when you write your message and you can save all your files into a single file by opening the main VI and selecting File>>Save with Options>>Development Distribution) and we will probably be able to find your problem.
To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
Try to take over the world!

Similar Messages

  • Static VI with Visa serial functions is very slow to display front panel

    THere is a delay time of about 10-20 seconds to "display" the first VI's front panel that has Visa serial functions in the source code.
    All works fine after the first load but the initial delay of the front panel load makes it look like the PC could hang during this time. AFter this other VI's load immediately with no delay. I am concerned because I do not want to have to load a VI manually every time I start the APP which is the only workaround I can do at this time.
    Im wondering if anyone else has seen this kind of behaviour.
    I do not remember this happening until I upgraded my APP to LV7.
    DEll optiplex GX260 with 500MB RAM, Win2k and using N.I PCI-232-16 card w/ LV7 now.
    Attachments:
    RECV_LOOP.vi ‏55 KB

    I would like to resurrect this thread, as I am having the same problem. The problem stems from the VISA resource control on my front panel, because I have many COM ports registered on my system. The last suggestion from Scott B. was to "post the resulting .SPY file and I'll take a look at it". So, here is my .SPY file, and as you can see, it takes far too long. As many of these COM ports were registerd from USB converters, most of them are not actually present at this time on the system. However, even the ports that ARE present take a long time to register (i.e. COM1 is present and shows 3 seconds to register). These COM ports shown in my VISA resource do not correspond to those shown in my Device Manager, nor do they correspond to those shown in MAX under Devices and Interfaces.
    I am using LV 7.0 on WinXP SP2, with VISA version 3.2.
    OK, I just discovered something that mostly cured the delay. When I was getting the VISA version number just now, from MAX in the Software>NI-VISA item, there is a tab "VISA Options", and another tree structure in the middle pane. Selecting "General Settings>Aliases", there was a list of the old COM ports, so I cleared this list and then re-started MAX, checked again, and now only the COM ports shown in "Devices and Interfaces" matched this list (which still doesn't match my Device Manager, but no matter). When I re-opened the LabVIEW FP, it opened quickly, and the ports listed in the VISA resource matched those I saw in MAX.
    At any rate, although I just cured the symptom, the original problem of old aliases in VISA causing unacceptable delay should be fixed by NI.
    David Moerman
    TruView Technology Integration Ltd.
    P.S. the message poster didn't allow my to post a *.spy extension, so here is the *.zip of it.
    Attachments:
    Capture.zip ‏2 KB

  • Is it possible to interface digital i/o modules using VISA serial?

    Hi,
          Iam using analog and digital modules from trycom for my project.I interface analog modules by modifying the sample code basic serial read and write given in LabVIEW examples.But i found difficulties in interfacing with the digital i/o modules.Is there any sample code forDigital I/O?Is it possible to interface the digital I/O using VISA serial?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Also i found from the net that digital i/o modules can be communicate with Hyperterminal..Is it possible?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

  • Some problems using some Matlab functions

    Hello,
    I have some trouble with MathScript when i want to use some MATLAB functions in it such as unique or histc. (i'm using windows 7 and LV2010 SP1)
    These functions are theoretically supported by MathScript insofar as they exist in MathScript Documentation but they return an error. This error explains that my matrix sizes are invalid but when we are doing exactly the same process with the same matrix in MATLAB, it ends well.
    So I checked the two MATLAB and MathScript documentations in order to see if there is a difference between the same functions. It is proving to be the same functionning in MathScript and in MATLAB so I am a little lost.
    In order to show you a concrete example :
    If we have a X matrix equals to (77 77; 88 96) and we are doing unique(X). The result is supposed to be (77 88 96) but mathscript returns an error.
    On the other hand, if X is not a matrix but a vector, unique ends well but i'm not interested in using some vectors (because it is exactly the same kind of problem with some others functions using only matrix).
    I could use a matlab node script but in this project, we would to avoid the use of a Matlab Licence.
    Do you have some idea in order to fix this kind of problem
    Thanks a lot

    Hi,
    Currently, the unique(X) in MathScript can accept vector input only. It reports error when X is a matrix. As a workaround, you can use
    unique(X(:))
    instead.

  • Out of memory problem using the API

    Hi all,
    I need your assistance, we are working with CDB 10.2 making searches and retrieving the documents with all their attributes.
    In our actual scenario we have a single user (which represents an application) accessing CDB. This user use several persistent sessions simultaneously. I mean, several thousands of final users connect to an application that uses one user of CDB to connect to CDB with several persistent sessions.
    To simulate this scenario we wrote java code that open five threads and make several searches (requesting all the attributes) using the same user on cdb.
    Retrieving a considerable amount of data found on the search (~5000), we found a “Out of memory” problem when we made these tests:
    -     5 threads obtaining 100 documents (and all their attributes) / search
    -     1 thread obtaining 500 documents (and all their attributes) / search
    -     Also we have same problem if we make several searches with less results
    We suppose it’s a configuration or code issue so we ask for your assistance and experience to solve it.
    Thanks for your help,
    Dani
    import java.sql.Connection;
    import oracle.ifs.examples.api.constants.AttributeRequests;
    import oracle.ifs.examples.api.util.CommonUtils;
    import oracle.ifs.fdk.Attributes;
    import oracle.ifs.fdk.ClientUtils;
    import oracle.ifs.fdk.FdkConstants;
    import oracle.ifs.fdk.FdkCredential;
    import oracle.ifs.fdk.ManagersFactory;
    import oracle.ifs.fdk.NamedValue;
    import oracle.ifs.fdk.Options;
    import oracle.ifs.fdk.SearchExpression;
    import oracle.ifs.fdk.SearchManager;
    import oracle.ifs.fdk.SimpleFdkCredential;
    import oracle.jdbc.pool.OracleDataSource;
    public class Prueba {
         public static void main(String args[]) {
              Thread thread = new BasicThread1();
              Thread thread1 = new BasicThread1();
              Thread thread2 = new BasicThread1();
              Thread thread3 = new BasicThread1();
              Thread thread4 = new BasicThread1();
              thread.start();
              thread1.start();
              thread2.start();
              thread3.start();
              thread4.start();
    class BasicThread1 extends Thread {
         public void run() {
              ManagersFactory session = null;
              try {
                   System.out.println(this.getName() + "-->init");
                   session = getSession();
                   SearchManager sManager = session.getSearchManager();
                   SearchExpression srchExpr = new SearchExpression(Attributes.SIZE,
                             new Integer(20000000), FdkConstants.OPERATOR_LESS_THAN);
                   NamedValue[] res = null;
                   for (int i = 0; i < 100000; i++) {
                        res = sManager.search(srchExpr, basicSearchOptions2,
                                  AttributeRequests.DOCUMENT_CATEGORY_ATTRIBUTES);
                   System.out.println(this.getName()+" --> fin sin error: " + res.length);
                   } catch (Throwable t) {
    t.printStackTrace();
    System.out.println("<--"+this.getName());
              } finally {
                   CommonUtils.bestEffortLogout(session);
         static NamedValue[] basicSearchOptions2 = new NamedValue[] {
                   ClientUtils.newNamedValue(
                                       Options.MULTILEVEL_FOLDER_RESTRICTION,
                                       Boolean.TRUE),
                   ClientUtils.newNamedValue(Options.SEARCH_FOR_DOCUMENTS,
                             Boolean.TRUE),
                   ClientUtils.newNamedValue(Options.SEARCH_FOR_FOLDERS,
                             Boolean.FALSE),
                   ClientUtils.newNamedValue(Options.RETURN_COUNT,
                             new Integer(500)) //<<Maximo nº de elementos
         private static ManagersFactory getSession() throws Exception {
         OracleDataSource ods = new OracleDataSource();
         ods.setURL("URL");
         Connection conn = ods.getConnection();
         FdkCredential credential = new SimpleFdkCredential("USER","PSW");
         ManagersFactory session = ManagersFactory.login(credential,
         "SERVER");
    return session;
    }

    re-Post

  • Memory Leak, Deallocati​ng memory after using imaqImageT​oArray() function

    I have created a program (LW/CVI- Imaq Vision), which uses a timer callback to acquire an image, convert the image to an array using the imaqImageToArray() function, manipulates the data in the array, converts the data to an image, displays the image, and disposes of the image(imaqDispose()), and apparently the imaqImageToArray() function clears the allocation pointer, however does not deallocate the memory, such that the next time the function is called again, imaq allocates new memory, thus eventually the application slows down and freezes due to lack of memory. Does anyone have any suggestions?

    Hello,
    You need to call the imaqDispose() for the assigned pointer to actually clear the allocated memory.
    iPointer = imaqImageToArray(imgInputImage,IMAQ_NO_RECT, &iCols, &iRows);
    imaqDispose (iPointer);
    Let me know if you have further questions regarding this.
    Best regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • Problem using SUM standard function  during Field Mapping

    Hi Experts ,
    I am trying to sum all LIFMG 's in in the lineitems of a particular
    header and map this result to Lifmg of the header.(Idoc with multiple headers and line item).I am using SUM standard function.
    Rough Source structure.
    Header1
          vbeln
    ....Lineitem1
          vbeln
          posnr
    ......LIFMG
    ....Lineitem2
            vbeln
            posnr
    ......LIFMG
    Header2
         vbeln
    ....Lineitem1
            vbeln
           posnr
    ......LIFMG
    ....Lineitem2
            vbeln
           posnr
    ......LIFMG
    I am able to find the SUM ...but in the target structure's Header field  I am getting
    repeated value of the corresponding sum in each header ...i.e.
    Header1
    LFIMG-- 100
    LFIMG    100
    Header2
    LFIMG-- 102
    LFIMG    102
    How to get a single value for each .
    Regards,
    Deepak

    Solved Myself ...
    Placed  sum after  if without else ...
    placing it before was causing ...those values to be replicated.

  • Some problem using in this function!!!

    Is it valid to write a function like this??
    CREATE OR REPLACE FUNCTION
    dept_dtls(DEPT_ID IN VARCHAR2)
    RETURN record is
    DEPT EMPLOYEE.DEPT_ID%TYPE;
    STATUS RECORD;
    BEGIN
    Select COUNT(DESIGNATION),
    into STATUS
    from EMPLOYEE
    where DEPT=DEPT_ID
    GROUP BY DESIGNATION;
    RETURN STATUS;
    END dept_dtls;

    There are many things that I don't understand here or probably Oracle even can't understand.
    RETURN record
    What is record? WHen yu are taking count(something), it would be a number so, status variable should hold number and so should be of number datatype. By the way, if you had used GROUP BY function, then there is every possibility that this select results in one or more number of records which fails the function with TOO_MANY_RECORDS exception.
    Cheers
    Sarma.

  • Problems with parity and flow control using visa serial

    I am trying to create a basic user interface with the options that my
    company uses most often for a force indicator.  You can configure
    the indicator over serial, as well as read the values off the
    indicator.  I am trying to create the user interface so that using
    producer/consumer loops with events, once you change a value, it will
    write that new value to the serial port, ie the device. 
    The problem I am having is transfering the parity and flow control
    values for the serial config to the Basic read write VI.  The
    problem is that once the consumer loop executes, it will write the
    values correctly to the VI, but then the outer loop executes 200 ms
    later and clears the values.  I know that this is normal behavior
    and that in order to keep the values stored, normally you would use a
    shift register.  I tried to use this and had some issues with
    correct data types/array mis-mtaches, ets, so I created an indicator
    and had a local vaible read the indicator, which seems to be working
    for the stop bits, read bits, baud rate, etc, but not the parity anf
    flow control.  I always get "blank" outputs for theses values (if
    you enable the digital display you can see that they are outputing the
    value 0 which correspondes to None in both cases, which is
    correct).  Even though it appears that it is outputting the
    correct value, I get an error that says the VISA property is
    invalid.  I initally did a search and found that my stop bit
    control was wrong (outputting double instead of integer), but I could
    not find anything on the parity/flow control issue.  I even tried
    to copy the serial config controls from the basic serial read/write to
    my dialog box and that did not work either.
    I would be grateful for any suggestions.
    Thanks
    Kenny
    Kenny
    Attachments:
    BGI_main pandc.zip ‏232 KB

    I should add that I am using LV 8.0 and that the serial config
    indicator in the consumer loop will be off the frontpanel in the final
    VI so that it is not visible to the user.
    Kenny

  • SQL query problem using analytical/report function

    Hello there,
    I am having some problem writing my query. I have this table below:
                  create table t (priority number,
                                  plannedamount number,
                                  availablepieces number,
                                  material_id varchar2(20))
    insert into t values (1, 15, 30, 'A');
    insert into t values (2, 20, 30, 'A');
    insert into t values (3, 5, 30, 'A');
    insert into t values (4, 8, 30, 'A');
    insert into t values (5, 4, 30, 'A');
    insert into t values (1, 2, 10, 'B');     PRIORITY|     PLANNED AMOUNT|AVAILABLE PIECES |     MATERIAL_ID
         1      15     30 A     
         2      20     30 A
         3      5     30 A
         4      8 30 A
         5      4     30 A
         1      2     30 B .
    Each line is a customer order ordering a material. I am grouping by material and ordering it by priority. I want to display a new column called pieces not reserved yet. This column will show that if the order can be fully reserved for that current order ordering by priority.
    If the row can be reserved it will substract and bring it to the next row. If it cannot the pieces not reserved will remain the same.
    I've tried using sum(), lead(), first(), lag(), etc but I still cannot get the correct result.
         PRIORITY|     PLANNED AMOUNT|PIECES NOT RESERVED YET |     MATERIAL_ID
         1      15     30 A     
         2      20     15 A
         3      5     15 A
         4      8     10 A
         5      4     2 A
         1      2     30 B
    Can anyone elaborate or have any hints on what method to use to create this column?
    Thanks. .
    Edited by: 998373 on Apr 5, 2013 11:42 AM
    Edited by: 998373 on Apr 5, 2013 11:43 AM

    From 10.x on
    with t(PRIORITY, PLANNED_AMOUNT,AVAILABLE_PIECES , MATERIAL_ID) as
    select      1, 15, 30, 'A' from dual union all
    select 2, 20, 30, 'A' from dual union all
    select 3, 5, 30, 'A' from dual union all
    select 4, 8, 30, 'A' from dual union all
    select 5, 4, 30, 'A' from dual union all
    select 1, 2, 30, 'B'  from dual
    select
      MATERIAL_ID
    , PRIORITY
    , PLANNED_AMOUNT
    , AVAILABLE_PIECES PIECES_NOT_RESERVED_YET
    from t
    model
    partition by (material_id)
    dimension by (PRIORITY)
    measures (
      PLANNED_AMOUNT
    , AVAILABLE_PIECES
    rules (
    AVAILABLE_PIECES[priority>1] order by priority=
      case when PLANNED_AMOUNT[cv()-1] <= AVAILABLE_PIECES[cv()-1]
           then AVAILABLE_PIECES[cv()-1] - PLANNED_AMOUNT[cv()-1]
           else AVAILABLE_PIECES[cv()-1]
      end
    MATERIAL_ID     PRIORITY     PLANNED_AMOUNT     PIECES_NOT_RESERVED_YET
    A     1     15     30
    A     2     20     15
    A     3     5     15
    A     4     8     10
    A     5     4     2
    B     1     2     30

  • Problem using in download function

    Dear Experts,
    I am using download function to download values from application server to desktop.
    After downloading the output is like the foollowing.
    0    temp     30    bar(kg)
    But now the user requirement is I have to print it like the following.
    0/temp/30/bar(kg)
    I have to delete the space and have to give '/' sign.
    Please help me to fix this.
    Thanks in Advance
    Ansuman Parhi

    Hi,
      THis is a simple conversion.
       First Upload file from application server using dataset concept and Store Internal table of Char field like
       Begin of itab occurs 0,
         Data(200) type c,
       End of itab .
       then Split that into some fields  space
      Loop at itab.
          Split itab-data at  ' ' into  fields,
          Concatenate fields into itab-data seperated by '/'
          Modify Itab.
      endloop.
      Then download this.

  • Not enough memory problem using Import from scanner

    I am using Photoshop CS4 Extended on a Windows XP Pro platform with 3.5 GB of memory. My scanner is an older Visoneer One Touch 8820 and has always worked well when using the File Import in PS. I now receive the message “Could not complete the import command because there is not enough memory (RAM)” when trying to import a scanned image. Under Preferences, Performance the Memory Usage shows 1689 MB of available RAM and Let Photoshop Use: is set to 1452 MB. The file I’m trying to scan is a grayscale business card and my One Touch interface shows the image size as 1.27 MB at 400 dpi. Any help is appreciated.
    TIA,
    Gregg

    hi mate,
    have you tried re-installing your current firmware? if you are still receiving errors, then you will need to take your phone to your local Nokia care for inspection: http://nokia.com/support
    Only do this after you have checked that you have moved all possible files to a PC or external memory card on the device.

  • Problems using Camera Raw function in Bridge CS5.1

    Hey so I don't know what the heck is going on, but Camera Raw was working perfectly for me when I got this computer. It's a work computer, and all the programs were recently installed. I like using Camera Raw because of the easy basic editing and mass rendering (from .nef to .jpg) because I do a lot of shooting as a journalist.
    Like I said, it was working fine for me the past three weeks. Now I get this error message:
    Camera Raw editing is not enabled
    Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature.
    I just installed the program, alongside PSE 12 Editor, and I have no idea how to fix this. Obviously, I've opened both Bridge and PSE, so I have no idea what I'm supposed to do now.
    Please please help. It's a MAJOR pain in the arse to have to edit every photo manually in PSE.

    You can use PSE with multiple Raw files also but Camera Raw in PSE has very limited options compared to the full ACR and also you can't save as jpeg via PSE.
    But do you have Photoshop CS5 installed because I can't find any info on that in your posts??
    Bridge CS4 was the only version that worked with PS elements (PSE 8??) but after that they discontinued the connection and since then PSE again uses its own organizer. So it is either using PSE for your work or you have to use Photoshop and Bridge.
    Adobe Camera Raw (ACR) is a plugin that comes with Photoshop. But Bridge has the option to also use this same plug in but it uses the PS version itself. If you open a Raw file in Bridge the normal way it opens in ACR via PS.
    If you choose right mouse click menu 'Open in Camera Raw' it uses ACR via Bridge. You can use both ACR at the same time. e.g. open multiple files in Bridge to load them as 'filmstrip mode' in the ACR window. Make your changes and choose 'save image'. While this jobs is running you can't use PS until the saving has finished.
    however if you return to Bridge and select another bunch and open this via 'Open in Camera Raw' the ACR window opens via Bridge. So while the first job is running in the background via PS you can start the second job via Bridge.
    Be sure to have the latest updates and the latest ACR version for Camera Raw (in your case it should be both PS and Bridge CS5.1 and ACR 6.7)
    In PS go to menu Photoshop / About Plug In / Camera Raw and this provides a window with the version of Camera Raw you are using.

  • How does VISA serial write work?

    I am using LabView 6.0 and the VISA functions to run a distributed sensor network using RS-485 from a NT 4.0 machine.
    In order to work properly I have to manually control the RTS line which isn't a problem using the property node.
    Here's what I want to know.
    I'm using a sequence structure:
    I'm writing a command using VISA serial write
    Then in the next frame I unassert the RTS.
    Now in this setup does Labview pass the command to the serial port and then jump to the next frame in the sequence, or is there some kind of acknowledgment from the serial port that its done so the Write vi knows to finish, or am I running a the risk of cutting off my communication before I've finished or should I put in a short wait after the write to port
    , or could this cause me to miss the reply?

    Robert:
    With the default settings, VISA Write will not return until the data has been at least posted into the hardware FIFO. To be 100% sure that the data has been transmitted over the wire, you should do these 2 things:
    1) Call VISA Flush I/O Buffer with a mask of 32. This will ensure the data has been at least posted into the hardware FIFO, regardless of which settings are being used.
    2) Wait a tiny amount of time for the FIFO to be emptied. This is based on the number of bytes in the FIFO and the baud rate. For example, with a 64 byte UART FIFO and 9600 baud, you should wait 67 milliseconds.
    Dan Mondrik
    Senior Software Engineer, NI-VISA
    National Instruments

  • Calling DLL using "Call library function"

    I am trying to combine labview with my previous fortran functions using Intel Visual Fortran 12.1 and labview 2012 by below steps.
     1. Compile Fortran functions as DLL file.
     2. Call Fortran function from LabView via "Call library function"
    In step 2, DLL file without linker option "/DLL delayimp.lib" cannot be loaded. That is "delay load" is needed for DLL file.
    Are there any limitation or constraint in Call library function?

    Hi Vishnu,
    There's no problem using the Malloc function in C and call it as a DLL in LabVIEW.
    But LabVIEW has a different memory management than C.
    It is probably not recommended to allocate array memory in C for labVIEW arrays
    You can use initialize array in LabVIEW instead.
    Good luck
    Van L
    NI Applications Engineer

Maybe you are looking for

  • Can you share music between iTunes accounts on the same computer

    Can you share music between iTunes accounts on the same computer? My kids iPods are under my account now with all of our shared music but they want their own iTunes accounts. I would like to transfer the music and apps that they purchased under my ac

  • Error message in Putting a file to remote server

    Hi: Although I am able to connect to the remote server, I am receiving the following error message when "putting" a file: An FTP error occurred - cannot put prices.php.  Access denied.  The file may not exist, or there could be a permission problem. 

  • Transaction code to table

    Hi ,      I have created a table and i need to assign a transaction code to it. that is to edit that table user has to go through a transaction only.is there any way out

  • Preferences Error. Could not load Dictation & Speech preferences pane.

    I recently upgraded to Yosemite and encountered this error when trying to open the Dictation & Speech preferences pane, "Preferences Error. Could not load Dictation & Speech preference pane." Has anyone encounter this? Thanks.

  • I can not sign out icloud in my iphone

    I gave away my old iPhone and  now the iPhone will not let me log out of the iCloud. The person that has the iPhone lives far away so I am not able to get the iPhone back and try to delete it manually. is there anyway you can reset the iPhone and rem