Memory leak with RS-485 visa

I tried to find a slow memory leak in a large application Labview (2012f3). Using perfmon, probes and breakpoints, I could trace the source of the leak of a series VI communication employing a number of nodes VISA. I have attached a slightly simplified version of the VI leaking (, as well as a VISA vi initialization and a VI of container to test.

Did anyone see any problems with the serialCommand VI that could possibly cause memory leak?

After reading all posts of the forum that I could find on memory leaks and VISA error, I was still unable to stop the leak. SomeofthethingsI'vetriedsofar:

-J' read VISA Close can cause leaks memory, so I disabled inside the loop (even if he was closing an event, not the port)

-J' wrote extra carriage at the beginning of the VI returns, before rinsing the pads

-J' was initially using VISA 5.2; After the upgrade to VISA 5.3, the leak occurred still

-J' replaced VISA nodes with constant value placeholders, and the leak repaired (not a solution, but the confirmation that it is the location of the leak)

It may also be worth noting that I don't remember when this leak memory in the previous development when I was watching for leaks, but a few days ago Labview executable generates started fails with the error 1, and the only way to get Labview to successfully build again should fix labview from Add/Remove Programs (Win 7 Ultimate) , so it could be related to a change of version in one of the packages that has been reinstalled.

Thank you.


Is there a reason that you use VISA events?  It seems that you expect just a character.  Why not to use playback VISA wait for a byte and use the timeout if the byte is not?

Tags: NI Software

Similar Questions

  • Weird memory leak with simple database

    I followed database, where a large (2 GB) text is read and put in a queue database. :

    unsigned int line_byte = 128;

    DB my_db(,0);
    my_db.set_re_len (line_byte);

    Open the database
    my_db. Open (NULL,

    Open the file
    FStream file;
    leader. Open ("file.csv", iOS::in);
    cost < < "could not open file! \n » ;

    unsigned long anz_line = 1;
    char buffer = new char [line_byte];
    Key to DBT (& anz_line, 4);
    DBT data(buffer,line_byte);
    {while(!file.) EOF())}
    file.GetLine (buffer, line_byte);
    my_db.put (NULL, & keys and data, DB_APPEND);
    If (anz_line % 100000 == 0) {}
    my_db. Sync (0);
    anz_line ++;

    delete [] buffer;
    leader. Close();
    my_db. Close (0);

    The program bed first in the 128 MB cache, this cache can be seen in the task windows in my task manager.
    After that they are use mystery to write to the hard disk. But! The RAM is used more, but windows taskmanage cant
    Show me wich Programm uses memory.
    After about 500 MB of the file is read, the RAM is full.
    After the end of the task, all memory is released again.
    If I run the program without the put, the task uses almost no RAM, and if I use a RECNO or a BTREE
    There is also this memory leak! Can I use Berkeley DB wrong, or how is it possible that this program uses memory more.

    I suspect you see Windows increases the size of its file system buffer cache as Berkeley DB writes data to the database files. It is a normal behavior of the operating system and does not have a leak: the memory is allocated as needed and can be released by writing data on the disk if necessary for other purposes.

    Check this box is to assign to the DB_DIRECT_DB indicator on the environment to see if the behavior changes of memory. Since you do not have an explicit environment, you can create a file DB_CONFIG containing the line:

    set_flags DB_DIRECT_DB

    or you can call () my_db.get_env-> set_flags (DB_DIRECT_DB, 1); just before the call to Db::open.

    Kind regards
    Michael Cahill, Oracle Berkeley DB.

  • Windows 2008 R2 64 bit servers with UAG memory leak

    We organize two Windows 2008 R2 64 bit with UAG servers.  We note that, during 10-14 days memory begins to run upstairs and users no longer able to connect to OWA through UAG.  We found KB971265 which talks about the memory leak known issues and provides a fix for Vista.  However, we do not find a similar fix for Windows 2008 R2 64 bit.  Does anyone have a suggestion?

    Hello JimBrighter,

    Thanks for visiting the site of the community responses to Microsoft Windows. The question you posted corresponds to the Windows 2008 R2 servers and would be better suited to the TechNet ITPRO community.

    Please visit the link below to find a community that will provide the support you want.

    They will be able to solve your problem.



  • Memory leak flow network with cluster of berries

    I use the network stream in sbRIO application, and I see a memory leak when endpoint RT is connected Windows endpoint. This happens with endpoints of chain and cluster tables parameters. I've attached an example that shows the behavior.

    I found this KB, which seems to explain the problem, but the solution it offers is just to spend on scalar types:

    I can't do it in my application; I need scalar data with a block of channels multiple samples and send the package everything together (as seen in the typedef that I included with the attached example). How can I handle this without creating a memory leak which will eventually cripple my application?

    Never mind. Definition of the size of the buffer to a lower value, got flight' to stop. I had it so great that the buffer allocated is still all the time that I was monitoring the application. When I changed to 50 elements, he has only spent a few seconds allowance, then stopped the "leak".

  • [JS CS5] problem with memory leak possible with the dialog box in the event handler


    I'm having a very difficult problem.

    I am attaching a script in a handler for a menu item, by using an installation script menu that I wrote based on one by Marc Autret. My version of the script menu installation attach a bunch of event handlers at the same time, to the actions of different menu.

    What is the event handler, with that I have a problem is to prompt the user for a URL and then applies the URL as a hyperlink to the text selection, with our house style for the way in which the URL should look like.

    The problem is the following:

    1. all other installed menu actions work very well, except for this one.

    2. the addition of URL script works fine, when you run it directly from the script menu.

    3. the combination of #1 and #2 (using the script to add URL by function as an event handler in the Edit menu) blocks to InDesign. But it is only after the addition of URL script has finished and done what it was supposed to do!

    4. when I comment on the section of the script URL adding user input, so that instead of saying

    userInput = myDisplayDialog();

    It is said

    userInput = "";   // userInput = myDisplayDialog();

    It works well as an event handler.

    So obviously a problem with the dialog box, but only when adding URL script is executed as an event handler. My first guess is that this is some kind of memory leak, but I think I am following the model of. destroy() the way I saw it elsewhere.

    Someone knows something like that before?

    I can provide all relevant if necessary scripts, but they are quite complicated. The most important of them is the input of the user function. Here it is:

    var myDisplayDialog = function( defaultText ) {
        var defaultText = defaultText || "";
        var myDialog = app.dialogs.add({
            name: "Type in a URL"
        var myOuterColumns = [];
        var myInnerColumns = [];
        var myOuterRows = [];
        var myBorderPanels = [];
        var myTextEditboxes = [];
        var myInput;
        myOuterColumns[0] = myDialog.dialogColumns.add();
        myOuterRows[0] = myOuterColumns[0].dialogRows.add();
        myBorderPanels[0] = myOuterRows[0].borderPanels.add();
        myInnerColumns[0] = myBorderPanels[0].dialogColumns.add();
            staticLabel: "URL:"
        myInnerColumns[1] = myBorderPanels[0].dialogColumns.add();
        myTextEditboxes[0] = myInnerColumns[1].textEditboxes.add({
             minWidth: 300,
             editContents: defaultText ? defaultText : "http://"
        var myResult =;
        var myInput = myTextEditboxes[0].editContents;
        if (myResult == false) {
        return myInput;

    Hi Richard,

    Unfortunately, there is no guarantee that the ScriptUI longer work.

    Thake a peek here:


    Marijan (tomaxxi)

  • There seems to be a MAJOR problem (blocking/memory leak) in "subject: House", also known as the Firefox Start Page, at 26.0 Firefox on Windows!

    There seems to be a MAJOR problem (blocking/memory leak) in "subject: House", also known as start up Firefox, 26.0 Firefox Page, Windows!

    seen on:
    -Windows 7 x 64 machine with 12 GB of RAM and high performance CPU (core i7-920)
    -Comments Machine virtual WinXP SP3 (in Oracle VirtualBox) running on the same computer
    -Intel Atom D525 netbook with 4 GB of RAM, running Win7 x 64

    None of these machines are connected through Sync or something like that. The Firefox instance on the virtual machine is a fresh install / clean.

    The problem:
    -100% of cpu usage for 10 seconds, (util in XP) memory usage goes up to 1.7 GB
    -If "subject: House" is actually the Firefox Start Page, it blocks the computer at startup of Firefox for 10 seconds
    -If "subject: House" isn't the Firefox Start Page, startup is fine - BUT if I press the "home" on the toolbar button it loads "on: House" which causes the same question once again

    Sounds that there is a problem with one of the code snippets that are responsible. I've seen several reports on this issue.

    You can set the browser.aboutHomeSnippets.updateUrl pref an empty string on the subject: the page of config to disable loading (new) checked to see if that helps.

    You can open the topic: config page through the address bar

    You must remove the ' storage\moz-security-about + origin "folder in the folder of Firefox to delete already profile stored clips.

    You can use this button to go to the Firefox profile folder:

  • On firefox memory leaks cause blue screens?

    On firefox memory leaks cause blue screens?

    If you encounter blue screen crashes, this majority refers often to an incompatibility with a device driver, especially the graphics drivers. Go to Firefox Safe Mode and disable the use of Firefox hardware acceleration of graphics.

    Assuming that Firefox is closed:

    Hold down the SHIFT key when you start Firefox. You should get a small dialog box. Click on 'Start mode safe' (not reset).

    (If Firefox is running, use Help > restart with disabled modules to call the dialog box.)

    In Firefox, open the Options of the Advanced tab dialog box:

    the button Firefox orange (or the Tools menu) > Options > advanced

    In the mini ' General' tab, uncheck the box for "use hardware acceleration when available.

    This will take effect after you exit Firefox and start it up again (in normal mode).

  • Firefox memory leak &lt;! DIFFICULTY! &gt;

    Hello fellow Firefox users!

    For most of us, Firefox suffers from a memory leak crazy, this can cause slowdown and perhaps even crashes. This happens mainly because when you close the tabs, the RAM, they took is always taxing your computer. Among other things cause this annoying leakage.

    Recently, I switched to Firefox and has this leak. I would not put upward with him, so I put solutions. Here's what I came with.

    Some addons I've handpicked, which when combined, are extremely effective.



    MemoryRestart 1.1

    Firefox slow acting? Try these great modules!

    SpeedFox 0.9.11


    Get all these together and make a leak free and faster Firefox!

    Additional details of the system

       Windows Vista
       Firefox 9.0.1

    More information

    Front of Add-ons
    Firefox could take up to 512 MB and up, leading to problems.
    Firefox could take some time to load the tabs sometimes.
    Download was OK.
    After Add-ons
    Use Firefox NEVER more than 512 MB, typically stays around 300 MB.
    Firefox almost NEVER slows down.
    Downloads go up to 4 x the average speed.
    Computer information
    Windows Vista
    4 GB of ram Ram HQ
    Firefox version 9
    3.0 MHZ AMDPhenII QuadCore
    NIVIDIA, VideoRAM 2048 DDR2

  • Satellite U500 memory leak - 18 p

    I have PSU8CE 18 p Satellite U500 with preinstalled Windows7 Home Premium x 64 with 4 GB RAM. When I start mode safe then memory not sunk. When I start it in Normal mode then nonpaged kernel memory develops up to 3011 MB (~ 4 days running).

    I downloaded poolmon.exe and Crescent pool tag found: "AmlH" (ACPI AMLI Pooltags). In safe mode, this pool has 1 single allocation unit. In Normal Mode ~ every 73 seconds he returned new unit. Size of each unit is 524288 bytes.

    Then I downloaded and installed "Windows Performance Toolkit" and run xperf.exe and xperfview.exe according to

    XperfView watch battery to leak memory in the

    Rootntkrnlmp.exe! KxStartSystemThread/ntkrnlmp.exe! PspSystemThreadStartup/ACPI.sys! ACPIWorkerThread/ACPI.sys! RestartCtxtPassive/ACPI.sys! InsertReadyQueue/ACPI.sys! RunContext/ACPI.sys! ParseTerm/ACPI.sys! Return/ACPI.sys! DupObjData/ACPI.sys! NewObjData/ACPI.sys! HeapAlloc/ACPI.sys! NewHeap/ntkrnlmp.exe! ExAllocatePoolWithTag

    I restored windows to State factory but still present memory leak.

    Memory leaks are a common error in programming.
    leak memory occurs when a computer program consumes memory, but is unable to release it in the operating system.

    In your case, it would be necessary to know what application or process that runs in the background do
    This can be very long process you would need to install a system of fees will need to check the memory leak after each installation of driver or another application

  • My Macbook Pro reboots after a memory leak every two hours

    Hey everybody. I'm having a problem with my MacBook Pro (retina, mid-2012), where he is recovering in market (usually after gel). In this case only (so far) while using Adobe Illustrator CC 2015 (to date). I also use a Wacom tablet (intuos 4, with latest drivers), drawing, which can also be the culprit.

    This happened with Yosemite, so I had upgraded to El Capitan - that does not solve the problem.

    I apologize if the problem is with myself! I get that this problem is probably the fault of Wacom, Adobe or myself - I just want to see what you think Mac-heads.

    Thanks a lot, a lot in advance for any advice - I appreciate any help I can get.

    The report I get, when restarting is as follows:

    Mon 4 Jan 20:19:13 2016

    Panic report *.

    panic (the appellant UC 7 0xffffff802d928e44): "zalloc: map of exhausted area during the allocation of the buf.8192 area, probably because of the memory leak in the area kalloc.512 (1063772160 bytes, 2076706 elements allocated)"@/Library/Caches/ /zalloc.c:2543.

    Backtrace (CPU 7), Frame: Return address

    0xffffff813887b150: 0xffffff802d8e5357

    0xffffff813887b1d0: 0xffffff802d928e44

    0xffffff813887b300: 0xffffff802daea851

    0xffffff813887b330: 0xffffff802dae8f19

    0xffffff813887b380: 0xffffff802dae8a23

    0xffffff813887b450: 0xffffff802daea040

    0xffffff813887b4b0: 0xffffff802dcf76fb

    0xffffff813887b520: 0xffffff802dd4cdfb

    0xffffff813887b5c0: 0xffffff802dd47845

    0xffffff813887b6d0: 0xffffff802dcfe66b

    0xffffff813887bc10: 0xffffff802dd3e695

    0xffffff813887bd20: 0xffffff802db112f2

    0xffffff813887bde0: 0xffffff802db1ce7c

    0xffffff813887bf30: 0xffffff802db11747

    0xffffff813887bf60: 0xffffff802de2ace1

    0xffffff813887bfb0: 0xffffff802d9f4896

    The process corresponding to the current thread BSD name: softwareupdated

    Mac OS version:

    15A 284

    Kernel version:

    Darwin Kernel Version 15.0.0: Wed Sep 26 16:57:32 PDT 2015; root:XNU-3247.1.106~1/RELEASE_X86_64

    Kernel UUID: 37BC582F-8BF4-3F65-AFBB-ECF792060C68

    Slide kernel: 0x000000002d600000

    Text of core base: 0xffffff802d800000

    Text __HIB base: 0xffffff802d700000

    Name of system model: MacBookPro10, 1 (Mac-C3EC7CD22292981F)

    Availability of the system in nanoseconds: 7390442512484

    Area name heart size free size

    VM 146329200 960 items

    machine virtual object hash 24008000 2240 c'entri

    VM 46592000 883520 map entries

    34959024 5424 pv_list

    VM 130327232 8768 pages

    16598128 27424 Kalloc.16

    16876000 21664 Kalloc.32

    77735808 199344 Kalloc.48

    Kalloc.64 37787264 95360

    2136000 5280 Kalloc.80

    Kalloc.96 1729824 67200

    Kalloc.128 130555904 30464

    1941600 135680 Kalloc.160

    133074944 292352 Kalloc.256

    45504 142195392 Kalloc.288

    1063772160 498688 Kalloc.512

    1003634688 2931712 Kalloc.1024

    6909952 24576 Kalloc.2048

    Kalloc.4096 9760768 0

    Kalloc.8192 10452992 0

    9606272-3968 mem_obj_control

    SCHED groups 1270080 36288

    IPC 81922240 150880 ports

    2081376 274480 discussions

    x 86 fpsave State 1411072 233792

    uthreads 1224752 209264

    31705680 2640 nodes

    12949920 4032 namecache

    Node 42278544 72816 HFS

    Fork 8548352 896 HFS

    1109304 1176 decmpfs_cnode

    buf.8192 23584768 0

    ubc_info area 5679696 6600

    vnode pager 2580000 1320 structur

    34320384 44864 compressor_pager

    20094976 5986304 compressor_segment

    The 3653632 kernel stacks

    PageTables 250183680

    Kalloc.Large 166412827

    Backtrace suspected leakage: (bytes pending: 206848)














    Extensions of core in backtrace: (203.7.1) [5178DF8C-1F96-3D 87-8BD4-46B996C41 84A]@0xffffff7fafd4e000-> 0xffffff7fafdb9fff

    dependency: (2.9) [668E3DEE-F98E-3456-92D6-F4FEEA355A72] @ 7fae12d000 0xffffff

    dependency: (2.4.1) [48AC8EA9-BD3C-3FDC-908D-09850215AA32] @0 xffffff7fae4a2000 (10.0.6) [7246A48B-E43B-3AF3-8285-8E793AE55B8C] @0xffffff7fafdc8 000-> 0xffffff7fafe64fff

    dependency: (2.9) [668E3DEE-F98E-3456-92D6-F4FEEA355A72] @ 7fae12d000 0xffffff

    dependency: ffff7fae4e9000 @0xff (2.4.1) [814A7F4B-03EF-384A-B205-9840F0594421]

    dependency: (10.0.6) [E177026A-B6F5-30AB-BF87-8ADC4D102278] @0xffffff7fae4ff000

    dependency: (2.4.1) [48AC8EA9-BD3C-3FDC-908D-09850215AA32] @0 xffffff7fae4a2000

    dependency: (203.7.1) [5178DF8C-1F96-3D 87-8BD4-46B996C41 84A]@0xffffff7fafd4e000

    last load kext to 510536257340: 3 (addr 0xffffff7fb0a11000 size 32768)

    Finally unloaded kext to 584400762104: 3 (addr 0xffffff7fb0a11000 size 32768)

    kexts responsible: 1.70 1.9.5d0 110.20.19 2.5.1d0 1.0.0

    com Apple.filesystems.autofs 3.0 124 1 272.50

    com Apple.Driver.pmtelemetry 1 272.50 1.0.1 4.4.0f4 3.6.1 7.0.0 10.0.8 10.0.6 1 4.4.0f4 1.0.0 3.0.8 3.1 208 1.2.13 10.0.8 3.11.31 4.0.0 245,4 245,4 1.0.0d1 1.0.0 37 2.8.0 1.7.0 1000.13.1a3 1.0.1

    3.1.5 4.0 161.0.0 2.0 1.8 2.1 4.0 1.7 218.0.0

    com Apple.NKE.applicationfirewall 163

    com Apple.Security.Quarantine 3 8 218.0.0 181 4.4.0f4 181

    com Apple.kext.Triggers 1.0 272.50 525 11 108.0.1 10.0.6 10.0.6 1 4.4.0f4 4.4.0f4 272.50 272.50 203.8 1.2.0 1.0.14d1 1.0.14d1 203.7.1 3.11.31 1.1.0 2.4.1 3.11.31 2.4.1 1.0.0 3.1.9 6.0.0d7 1.0.0 3.7.7 250.4 900.4.1 1.0.1 1.0.1 517 4.1.2 4.1.2 2.0.2 4.0.1 5.0.6 1100.23 1.0.1b8 3.2

    com Apple.Driver.corecapture 1.0.4 1.0.1 2.8.0 1.0.1 1.0.1 900.4.1 1.0.1 1.0.1 2.0 2.0.0 2.0 1.1

    com Apple.Security.sandbox 300.0 1.0.0d1 2 1.0.5 1.0 414 2.1 31 28.30 4.0 2.9 1.4 1

    com Apple.KEC.pthread 1

    com Apple.KEC.corecrypto 1.0

    Panic report suggests that the issue is in the video/graphis material. Please make an appointment at the Apple Store - Genius Bar store and bring it into service. If you are in the United States or is unable to make an appointment in this way, contact your Apple store.

  • Defective touchpad (Synaptics) and slow computer after extended use (memory leak)

    Two problems have been caused with my HP Split 2 x since I bought it 2 months ago:

    (1) the touchpad works sometimes for a few seconds, while the touchscreen still work OK.

    (2) the computer becomes slow after a while of use (which varies from a few minutes to a few hours usually). The Task Manager shows 98%-99% of memory, most of which use (3.6 GB / 4 GB) are not paged memory.

    I suspect the two issues are related to a faulty Synaptics driver, according to:

    and .

    I did the same test as the second link with the same result: Open "Task Manager" (Ctrl-Shift-Esc), on the 'Performance' tab, select 'memory '. Note the value for "Non paged memory. If I move the touchpad, it increases to about 1 MB every 5 seconds. If I stop moving, the value remains constant.

    I use the preinstalled Synaptics driver, version (Sep 06, 2013) for 64-bit 8.1 window.

    Everyone has the same problem, or use it without these issues?

    I would like to know if a restoration system or factory reset may fix.


    Microsoft has just released an update for Synaptics Driver, not thanks to HP which has not found a way to provide the possible Synaptics driver as an OEM update.

    Update Windows Update to Sypatics HD TouchPad two days ago, but I would not be allowed to install as it kept then mainly in giving the 800F0100 error Code. After some research on the Internet I could find that an installation manual after the WU has downloaded the driver would be possible.

    So I went to the Device Manager > mice and other pointing devices > TouchPad Synaptics HID > properties > driver > Update Driver > Browse my computer for driver software and shown the finger/windows/C:\Windows\SoftwareDistribution/Download and everything worked like a charm = D

    I have no more memory leak and now after SEVEN MONTHS I finally can use gestures that it was supposed to.

    But I still annoyed gel problems which in my case is a dysfunction between the screen and the dock.

    Just that you wanted the guys at Microsoft to know is the solution, not the HP that would have had if they have signed and put the driver since November last at our disposal. Blame it on you, HP.


  • UDP/Lakes memory leaks?

    I wonder if anyone has had problems with memory leaks/Lakes when you use UDP and data queues?

    The program has a section of code where the queues are loaded with the data read from different UDP ports. The queues are then read by a loop (which is triggered by a source of synchronization of 1 kHz) and some of the data is displayed on the Panel before the main VI. When the program runs it loses memory about 100 Kbps leading to a failure in about 4-5 hours, when the physical RAM is at its maximum.

    I think that I traced the question (using the DETT it shows several memory allocation operations) to the Subvi I join which fills the queues. Can anyone help to emphasize something that could lead to leaks of memory/Lakes?

    Thank you!

    I suspect that the problem is that you are not emptying queues quickly enough. And is not in the code you have posted. There's also a few subVIs, classes, and controls.

    Usually call loops should only be used on real-time operating systems. They offer no advantage over the standard while loop and have an additional charge when using a desktop OS. Also placing indicators within the quick loops can create problems. The operating system does not update the screen dozens of times per second, so wrote indicators 1000 times per second LV forces or the operating system, or both to manipulate data.

    Having multiple synchronization methods in a loop can lead to problems.  UDP timeout is probably based on the clock count of ticks. If you have the timeout of read of the UPD defined with a value greater than zero, the UDP bed may take longer than the timed loop interval.  The timeout of read UDP allows a wait in a standard while loop.


  • tool tip memory leak

    Seems to be leaking memory associated with ToolTips.  Every time I put your mouse on a panel using tool tips I see case the dynamic memory usage constantly increases.  If I comment out the call to the functions of the tool tip (i.e. SetCtrlToolTipAttribute), memory leak disappears.

    There is no patch for 8.0.0, if it is tell you.

    But from the Toolbox of the programming interface is open-source, you can easily fix it yourself:

    The 8.0.0 3365 online version of C:\Program NIUninstaller Instruments\CVI80\toolslib\toolbox\toolbox.c, you need to add the function call following ListDispose:

    If (RectContainsPoint (bounds, point))
    PointConvertCoordinates (Panel, child, & point, FALSE);
    ListDispose (sortedChildren);
    Return PointToPanel (child, point);

    After you make the change, you will have to recompile the file (Options > create a file object) to regenerate the object file and restart CVI.


  • LabView VB6 Dll interface causes memory leak


    We use a large written in vb6 in our laboratory measurement built house software. Recently, we have added a new detector that is read using a labview vi that is called using a dll directly from vb6. Here, we call the function for example of read_detector which starts the collection of data and in a next step writes the data to a string. When you have finished the called function returns a pointer to the string and its length. VB6, we read this pointer and process data.

    This is a memory leak. This could be the case because we presets not memory for labview to write in and so just writing lab data in memory without releasing again? In the current configuration, the function of the dll is just called again and again and each lab view creates a variable outputstring.

    If we allocate the memory. How can we achieve for vb6?



    Well first of all, a handful of string LabVIEW is a very specific type of data LabVIEW. Not only is only LabVIEW himself knows exactly how to allocate and deallocate, but you must also allocate and deallocate in exactly the same instance of LabVIEW. Given that your LabVIEW DLL is executed for this purpose inside the DLL to run LabVIEW, you must also recover the LabVIEW memory manager functions according to DSDisposeHandle() of the lvrt.dll and call it after you are finished with the strings returned by the DLL function. This is however made very complicated since there are circumstances where not lvrt.dll is actually used by your DLL but another LabVIEW runtime system. And if you happen to have two DLLs created with different versions of LabVIEW LabVIEW, each of them will load and use its enforcement LabVIEW system according to DLL load next. Believe me, you don't want to know how next dll works and how to make this opportunity to work in an application. This is the way for Microsoft to create a monster to manage the hell of the DLL and in this way, rather to create exponential version of hell.

    You create just two memory leaks for each call of DLL function at the moment. LabVIEW creates a new handle of string for each of the parameters string at each call, you dereference the pointer, and then copy the contents into a SysString. But you let the chain handles LabVIEW blow created around the stack and the next your function call, you initialize the new variables of the battery which is initialized to null and LabVIEW creates two new handles. Also you need to do is to define an "Integer DSDisposeHandle(LStrHandle As Long)" exported lvrt.dll function and call it once you have copied the data of the handle in your SysString for both of these handles.

    But basically calling a DLL LabVIEW from no LabVIEW code and using LabVIEW handles string or array as parameters is several times more trouble that it's worth. The easiest would be fair, allocate a large enough buffer beforehand and pass those to the Configuration of the service DLL LabVIEW function to not accept a handful of string LabVIEW but a pointer to a string C instead. Do you work around the problem on the memory allocated by someone else to worry about your own program of VB and duty he properly release. The disadvantage of this approach is, that you should make sure that the memory allocated buffer is large enough for the maximum possible length that your DLL function may never return.

    But another approach might be to leave out LabVIEW total here and call the DAQmx APIs directly from VB.

  • TDMS write memory leak

    I use TDMS to store test data that seems to be causing a memory leak in my (very convincingly) program. Below is a graph of the three versions of my program. Series 1 uses storing data open PDM, the data file added and closed every 5 seconds. Series 2 uses storing data PDM with a referense remaining open during operation and closed at the end 3 series written data in a CSV file. The charts show the use of LabVIEW memory each seconde.5 ~ 4 hours of a 10 hour test.

    LabVIEW 8.6.1

    Windows XP SP3

    Further explanations... when a TDMS file is opened, LabVIEW will create an index in memory structure that is used for random access to the file. The Streaming API integrated LabVIEW TDM will always create the index, even if you just write. The size of the index is not dependent on the size of the file, but on how fragmented file is. If you store a relatively small number of large blocks of data, the index will be very low. If you keep adding small amounts of data on your record, it could make big enough. A cure for this is the property of NI_MinimumBufferSize. You can set this property on a channel to the LabVIEW to a number of values of the buffer before storing. In this way, data from multiple calls to 'Write TDMS' counts as a data segment in the file. Typical values for this are 1000 or 10000. Fragmentation of files and memory footprint are reduced accordingly, but LabVIEW uses little memory for buffers.

    If all else fails and you do not have access to the file of reading while you write, you can also use the VI-based TDMS API. This will not build the structure of the index that I mentioned above, so there should be no increase in memory at all. In this case, I recommend to defragment files front of post-processing.

    Hope that helps,


Maybe you are looking for

  • Required screen saver?

    Guys and girls A screen saver is necessary for my iMac 27 inches? Phil

  • Camileo S10 clicks in sound and in drops in volume

    Hello Yesterday, I bought the Toshiba Camileo S10 camcorder.Everything seems to work fine apart from the sound which is unacceptable. Here's the problem: I record a video on playback on my computer the pop sound every now and then randomly and enjoys

  • Cannot change the ascending ringtone?

    When a call comes ringing starts from lower to higher volumes. Normally in phones there are options as ascendant etc. vibrating or is it possible that we can set the ring on ring directly from higher volume instead of from lower ringtone?

  • HP Deskjet 3050 a J611: Driver not recognized HP 3050 has J611

    I recently got a printer HP Deskjet 3050 a J611.  I get an error message saying driver is not updated.  I downloaded the driver (not sure if it was good because there is a choice of 3) (J611a, J611b and J611g).  I tried again and it still does not. 

  • Laptop delivered x 64 Vista, but x 86 installed Win7 - install 64-bit drivers or 32-bit?

    My Presario F572US delivered as a 64-bit with Windows Vista installed.  I upgraded the RAM to 2 GB and installed Windows 7 Home Premium 32-bit. If I understand correctly, install the 32-bit operating system on the computer portable 64-bit is OK, but