Dynamic memory is corrupt (Labwindows/cvi 2010)

I have a multi threaded application....where I have a buffers allocated ineternally in the threads,,...A user interface is present to abort the therad execution.
Here is the code in one of the threads (NOTE: status is set by a user button to EXIT the program):
int EthernetDataStructureThread (void *functionData)
    CmtSetCurrentThreadPriority (2);
    EthernetData GetData={0}, *data=NULL;
    data = &GetData;
    /* Use a buffer to read the data from the queue which is coming from TCP read with fresh data */
    const void *BufferEth;
    int BytesRead=0;
    int BytesWritten=0;
    char ReadErrorMessage[256];
    BOOL bitset = FALSE;
    if ( (BufferEth = (EthernetData*)malloc(EthernetDataSize)) != NULL)
        while ( !status )
            BytesRead = CmtReadTSQData (Queue_TCPRead_EthernetData, BufferEth, EthernetDataSize, TSQ_INFINITE_TIMEOUT, 0);
            memcpy (data, BufferEth, EthernetDataSize);
            /* Empty the queue so that we don't have data in next time. */
            CmtFlushTSQ (Queue_TCPRead_EthernetData, TSQ_FLUSH_ALL, NULL);
            //Pass on the data to the Main thread
            BytesWritten = CmtWriteTSQData (Queue_EthernetData_Main, BufferEth , EthernetDataSize, 1, NULL);
            if ( BytesWritten != EthernetDataSize)
                 free(BufferEth);
                BufferEth = NULL;
                exit(0);
            Delay(0.02);
        if (status && !bitset)
            free(BufferEth);
            BufferEth = NULL;
            bitset = TRUE;
    return 0;
My problem is: free(BuffEth) always says Dynamic Memory is corrupt......When I put a breakpoint and keep seeing the resource tracking window, I can see it getting executed fine as the resource tracking window greys out the memory block....but then suddenly free wants to exceute again...and causes the "dynamic memory is corrupt" error.
I am using LABWINDOWS /CVI 2010 SP1 in WinXP.
Please help me ASAP....very much appreciated.
Regards
NITIN
-Nharish

Thank you for your reply Jackie.
I am calling Free only once...there is an If condition there.
See the attched video for my problem...Free frees the memory block (see the greyed out portion in resource tracking window but still the statement controls remains there and free executes again, throwing error).
Do you  think it is some sort of bug in LABWINDOWS.
See the attached video.
-Nharish
Attachments:
FreeproblemLabwindows.avi ‏4781 KB

Similar Messages

  • Announcement: LabWindows/CVI 2010 SP1 Run-Time Engine Updated

    A new version of the LabWindows/CVI 2010 SP1 Run-Time Engine (10.0.1.434) is now available for download. The new version includes Security Update 5Q5FJ4QW which resolves security vulnerabilities in components installed with LabWindows/CVI 2010 SP1 and earlier and LabVIEW 2011 and earlier. Further details can be found at KnowledgeBase Article 5Q5FJ4QW: How Does National Instruments Security Update 5Q5FJ4QW Affect Me? Installing the security update will have the same effect as installing the new version of the Run-Time Engine.
    The update can be downloaded from the Drivers and Updates page. The LabWindows/CVIRun-Time Engine is a free download.
    National Instruments
    Product Support Engineer

    The correct link should be this one
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Labwindows CVI 2010 and GetProcessAddress()

    I am using Labwindows CVI 2010 v10.0.1 after upgrading from version CVI 2010 v10.0.0. After the upgrade, I have a compile error from a statement that compiles just fine in the previous version. The error is:
    "Operands of = have illegal types 'pointer to __stdcall int function(int,pointer to char,pointer to char,pointer to char,int,pointer to char,pointer to char)' and 'FARPROC'."
    What causes this error is the following statement in the code:
    my_FP = GetProcAddress(dll_handle, "DLL_FUNCT");
    and the definition of my_FP is:
    int __stdcall (*my_FP)(int x, char y[], char z[], char *m, int g, char A[], char B[]);
    (function names and parameters have been changed for simplicity)
    As I said, this line compiles just fine in 10.0.0, but not in 10.0.1. Is there a specific update to the compiler that will cause this error? What can be done to fix this?
    Thank you very much for your time and help.
    Solved!
    Go to Solution.

    You're correct. This was caused by a change in CVI Windows SDK headers that took place in version 2010 SP1. The change was associated with bug fix #275934. Unfortunately, this bug fix introduced this undesirable side effect of requiring a cast for any function that returns a FARPROC function poinrter (such as GetProcAddress). Upon further reflection, this side effect is unacceptable, and needs to be corrected in the next release. This is being tracked internally with bug ID #336341.
    I'm really sorry for this inconvenience. Until the problem is resolved, using the typedef & cast solution that you already implemented is a valid workaround.
    An alternative workaround, in case you're worried about other projects, or other functions, where this error might also pop up, is to edit CVI2010\sdk\include\windef.h and replace the following FARPROC definitions (in lines 226 and 230, respectively):
    typedef INT_PTR (FAR WINAPI *FARPROC)(void);
    typedef int (FAR WINAPI *FARPROC)(void);
    with:
    typedef INT_PTR (FAR WINAPI *FARPROC)();
    typedef int (FAR WINAPI *FARPROC)();
    Doing this will avoid the problem throughout a given installation of CVI.
    Luis
    NI

  • How to create ActiveX Control in LabWindows/CVI 2010

    I have LabWindows/CVI 2010 Full Development System (Debug Only) installed on a stand alone PC with Windows 7 (64bit).  Also I have Matlab (R2011a) (also 64bit) installed on this PC.  I tried to use "Create ActiveX Controller" under ""Tools".  I can locate the "Matlab Application (version 7.12) Type Library" in the ActiveX Controller Wizard. After click "next", I got a message "The Type Library is not intended for use on Win32".  My questions are:
    1) Is my LabWindows/CVI 32bit or 64bit?
    2) How to create my Matlab ActiveX Control?
    Thank you.

    Hi JGS,
    It means that you cannot use 64 bit libraries in CVI ti create Activex controls since CVI is a 32 bit application. You can however create 64 bit dlls, executables and static libraries. Here is a link to some information:
    http://zone.ni.com/reference/en-XX/help/370051T-01/cvi/programmerref/creating32bitappsversus64bitapp...
    Regards,
    Perry S.
    Applications Engineer
    National Instruments

  • How can I convert a project from LabWindows/CVI 2010 to a Visual Studio 2011 project?

    I have a good sized project, 12 source files, 14 headers, 1 uir, that I want to be able to edit and compile in MS Visual Studio 2011, MSVC++.
    I remember being told that LabWindows dropped support for C++ in 2008 and no longer had a wizard for converting projects. I know I can go the DLL route, but I have never created a DLL before and wouldn't know where to begin with it. What would be the best way to go about this conversion?
    Solved!
    Go to Solution.

    CVI 2010 still supports the Visual Studio Conversion Wizard for Visual Studio 2005/2008. We do plan to add support for VS 2010 in a future release.
    If you need a VS 2010 project now, you can use the Visual Studio 2008 conversion wizard, then upgrade the VS 2008 project to VS 2010.
    National Instruments
    Product Support Engineer

  • Can I create a merge module (.msm) in LabWindows/CVI 2010?

    Is it possible to create .msm files in LabWindows/CVI 10?  If so could someone just point me in right direction please?  Thank you.
    Solved!
    Go to Solution.

    You can't create merge modules in CVI but you can consume merge modules in our distribution builder. Normally, if you needed to create a merge module, you would create the merge module in a tool like WiX and then consume it in CVI. Just out of curiosity, what exactly are you trying to do? 
    Jonathan N.
    National Instruments

  • Labwindows cvi 2010 sp1 Device drivers

    Hi all
      I am trying to install cvi 2010 sp1 and it is asking for the Device Drivers for the program, where can I find the drivers for the sp1.
    To finish installing
    I have some older drivers but what is the latest for sp1
    Thanks in advance

    Hi Iriddick,
    You can choose to not install the Device Drivers with CVI and you will not get that window.  You can also cancel installing the Device Drivers without cancelling the CVI installation.  If you would like to install the Device Drivers, you can find the latest version by searching for "device drivers" at the ni.com main page.  The current latest version is the NI Device Drivers 2011.08.
    Regards,
    Brandon V.
    Applications Engineering
    National Instruments
    www.ni.com/support

  • I get "dynamic memory is corrupt" when I call HarmonicAnalyzer function

    Hello,
    I am using a PCI-6025E to acquire analog signals. I want to measure the THD of some of them, so I have copied the function "Total_Harmonic_Distortion" from the THD_Analyzer.prj example of NI.
    Sometimes, my program crash when it tries to execute the HarmonicAnalyzer function.
    My program is multi-threading, the acquisition and the THD measurement is made in the same thread.
    Someone can help me to fix this problem?
    Thanks

    Dear SebastianN,
    thanks for your suggestion. I have tried to call the "CVIDynamicMemoryInfo" before the HarmonicAnalyzer function, but it has no effect on the program itself (I get always the memory corrupt message).
    Yesterday I tried to call the Total_Harmonic_Distortion only if the RMS value of my buffer is greater than 1.0, and I replaced all my malloc functions by calloc functions. Till now it seems to work, but I cannot understand why, and I'm not sure that really I fixed the problem...

  • Solving corrupt dynamic memory problem

    Using LabWindows/CVI 2010, Windows XP. I have a data acquisition program that uses a rather large number of dynamically allocated arrays as buffers. The buffers are used to hold data from DAQmx and are passed and copied to a number of thread-safe queues and other routines. In certain circumstances, when I free one buffer I get a "dynamic memory is corrupt" error, which probably means - from reading the other posts on this topic on this forum - that some buffer was written past its end and corrupted the dynamic memory linked list. Is there any good way to determine exactly <i>which</i> buffer was corrupted? I don't believe that it was the one that I get the error on, it was probably the previous or next one in the chain. I can see the memory chain in the resource window, but I'm not sure how to interpret it.

    Hi pblase, 
    Here is an KnowledgeBase article that was written for LabWindows\CVI 6.0 but it still has some valid suggestions for debugging in LabWindows\CVI 2010:
    http://digital.ni.com/public.nsf/allkb/862567530005F09C8625632500692F41?OpenDocument
    There are three valid suggestions to debug from this article.  The only one that does not work still is the Run » Dynamic Memory feature.
    Peter T
    Applications Engineer
    National Instruments

  • The applicatio​n uninstalle​r ,created with Labwindows CVI, doesn´t work after upgrading to 2010 version

    Hi,
    I have been working with Labwindows CVI 2009 with no problem but after upgrading to 2010 version I have the following problem:
    When i´m going to execute the unistaller, either from Windows Control Panel or directly from the uninst.exe icon, it doesn´t work. The PC thinks a few seconds and does nothing, and it happens with all the applications I build with Labwindows CVi 2010.
    Thanks,
    Asier
    Solved!
    Go to Solution.

    Hello -
    Are you installing these distributions on a non-English operating system?  If so, the first thing to try would be the workaround listed on this known issue. 
    The known issue only lists Italian OSs as the troublesome OS, but it could actually happen on many different non-English OSs. I will update the text accordingly the next time I update the known issues list.
    NickB
    National Instruments

  • LabWindows/CVI 2009 Run-Time Engine update

    I wanted to let everyone know that NI has released an udpated CVI 2009 Run-Time Engine. Information on what bug(s) this update fixes can be found here. If you are currently not using the CVI 2009 Run-Time Engine, you do not need to install this update.
    This is an updated installation of the CVI Run-Time Engine, not a patch. If you download and install this update it will upgrade whichever version of the CVI Run-Time Engine you currently have to version 9.1.0.428 (CVI 2009 released with version 9.1.0.427). One way to find out which version of the CVI Run-Time Engine you have installed is to view the version number of c:\windows\system32\cvirte.dll. If you install version 9.1.0.428, any installer distributions that you create from any version of the CVI ADE will include version 9.1.0.428.
    If you have not yet installed LabWindows/CVI 2009, it's recommended that you install this update, either before or after you install CVI 2009.
    Luis

    To be clear, the original problem that you reported ("Attempt to free pointer to memory not allocated by malloc() or calloc()") might very have been the problem that this patch fixed, which was in fact new to 2009. But that problem only happens if there were actual plots in the graph.
    However, after looking at the "dynamic memory is corrupt" isse some more, it turns out that it is actually expected behavior, believe it or not. This is a limitation of easytab controls, caused by how they use callback chaining in their implementation. Whenever a panel or a control has its callback chained, you cannot change the callback, or make a copy of it after the chaining takes place. This is described in the EasyTab_ConvertFromCanvas function help ("...For the same reasons, do not call DuplicatePanel or DuplicateCtrl on any of these panels or controls after the Easy Tab control has been created.").
    As you probably have read elsewhere, easytab controls are quite obsolete. They were a stopgap "solution" to the problem of there not being a native tab control in the CVI user interface library. Native tab controls were finally added in CVI 8.0, and so we recommend that, if possible, users update their code to use these instead.
    Luis

  • TDMS functions much slower in CVI 2010

    Hello everyone.
    Today I noticed that at least some TDMS functions are much slower in CVI 2010 compared to CVI 2009 SP1 and prior. I have created and attached a simple sample project that creates a TDMS file with about 3000 file level properties and tries to read it back in afterwards. On all releases prior to 2010, this needs less than 10 seconds. On 2010 it's around an hour, if not more! Unfortunateky this is pretty much a show-stopper for me. Any comments?
    Thanks, Marcel 
    Attachments:
    tdmsTimingTest.zip ‏3 KB

    Hello Marcel -
    What you've reported is actually a known issue, and is unfortunately considered to be expected behavior.  Let me try to explain:
    There was a relatively large refactoring of the underlying TDMS code in LabWindows/CVI 2010.  This refactoring was intended to more closely align our internal implementation to that of LabVIEW.  As a result of this refactoring, we were able to address some internal issues we had previously been unable to address, as well as more correctly handle the data stored in the TDMS file.  Unfortunately, this refactoring unmasked a performance issue that had always been present when reading a large number of properties one at a time.
    This performance issue was not uncovered for LabWindows/CVI 2010 because we had previously focused our performance testing on reading and writing data to a file, not metadata.  We considered it unlikely that a customer would have more than dozens of properties for any one channel or group or file, and as a result, the performance issues you've reported were overlooked.
    However, we did recently find the performance issues you've reported.  As a result, there will be a handful of undocumented functions for returning all (or a subset of) properties on a channel, group, or file in LabWindows/CVI 2010 SP1.  This will allow for performance in line with what you'd seen in LabWindows/CVI 2009 SP1 and earlier, as long as you are OK with grabbing all the properties at once.  These functions are undocumented because, in general, we don't release new features with service packs.  Also, the functions are a little more difficult to use than normal CVI APIs, so we have not yet determined how or when they will be publicly documented.  When LabWindows/CVI 2010 SP1 releases (later this summer), feel free to reply back to this post or send me a private message, and I'll work with you on the details of calling these undocumented functions.
    Out of curiosity, we'd like to know your use case for creating that many properties.  You're the first customer we've encountered using such a large number of properties, and we'd like to ensure that we are able to satisfy your use case in future versions of the API.
    Thanks for the report, and I'm sorry for any inconvenience this has caused,
    NickB
    National Instruments

  • Announcement: Security Update 5Q5FJ4QW for multiple versions of LabWindows/CVI and LabVIEW

    An update for LabWindows/CVI and LabVIEW users is now available for download. This update resolves security vulnerabilities in components installed with LabWindows/CVI 2010 SP1 and earlier and LabVIEW 2011 and earlier. Further details can be found at KnowledgeBase Article 5Q5FJ4QW: How Does National Instruments Security Update 5Q5FJ4QW Affect Me?
    The update can be downloaded with NI Update Service 2.0 (which installs with LabWindows/CVI 2010 SP1 and LabVIEW 2011) or from the Drivers and Updates page. Information about the update is also available in other languages through links in the Drivers and Updates page.
    This is free update for all LabWindows/CVI and LabVIEW users.
    National Instruments
    Product Support Engineer

    The correct link should be this one
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • [Labwindows/CVI] Integration d'une DLL VC++

    Bonjour à tous,
    J'ai une DLL VC++ avec le .h et le .lib et je n'arrive pas à l'integrer correctement dans un projet CVI.
    dans le .h j'ai une fonction declaré comme suite
    GET_TX(const int FreqMhz, double& resultsevm);
    Labwindows n'accepte pas le passage par reference (double&) donc j'ai modifier la declaration comme suite à fin de l'integrer
    GET_TX(const int FreqMhz, double *resultsevm);
    c'est vrai que j'ai pas d'erreur de compilation suite a cette modif, mais il me semble que la valeur resultsevm retourné par la DLL pas correcte (valeur tres grand % au valeur attendu ) !!!
    Pouvez-vous m'expliquer comment faire pour integrer la dll correctement ?
    si non comment loader la dll dynamiquement ?
    merci d'avance

    Bonjour Tanite, et bienvenue sur le forum de discussins de National Instruments.
    Voici deux documents qui pourraient éventuellement vous aider à utiliser votre DLL dans votre projet CVI :
    1. Creating Import Libraries for a DLL in LabWindows/CVI
    2. FAQ: Using Dynamic Link Libraries with LabWindows/CVI
    Cordialement,
    Vincent.O
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    Été de LabVIEW 2014
    12 présentations en ligne, du 30 juin au 18 juillet

  • LabWindows CVI 2009 Word_Rpt routines: Document is corrupted: Error reported: The MSWORD.OLB file cannot be opened.?

    Using WordRpt support routines with a C application in LabWindows CVI 2009 to format Word files, an error sometimes occurs resulting in the document format being corrupted.  An error  is generated: The MSWORD.OLB file cannot be opened.  I don't know why or how to correct this problem.
    Any help you can provide would be appreciated!

    Hi LPR1,
    Do you have an application that reproduces this.  If so, do you mind posting it?
    Regards,
    Hassan Atassi
    NI Community Project Engineer

Maybe you are looking for

  • UIX- How to use sequence in JDev 10.1.2

    Hi, I have a UIX Page displaying Employees view in a readonly Table format. Here I hide the employeeId field by setting the rendered property to false. I create another UIX Page for create/modify employee by dragging and dropping EmployeesView in Inp

  • Elecetricity leakage on the body of mac pro while charging

    I bought a new mac pro a few days back and noticed that the body leaks current when connected to the charging point without the extension cord. I got the machine changed and after two days of waiting I got a machine with the same problem. Its a quali

  • Error  WebLogic Server 11gR1 (10.3.1) package Installer Windows

    Hil all, I´m installing Oracle WebLogic Server 11gR1 (10.3.1) for windows, I´ve already download from this URL de Package Installer (all of them) http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html and all of them have the sam

  • CC Not Showing All of My Apps AND CC Does Not Work Offline

    First of all, CC shows in my menu bar (on my MBP) but it says I only have PS and Bridge. I am signed up via the 'photography program' so both PS and LR should show on the list -- but they don't. I THINK both apps are updating but I am unsure of that.

  • Do I return an object within or outside a try block?

    I am getting some strange errors/compile messages within a block of code that I introduced a try and catch. Before I used it, everything worked fine, example - this works: public OracleConnection connect() throws Exception{ Connection con = ...create