Memory Leak when I get the SP return refcursor by oracle ODBC driver:

Oracle server:HP-Unix
Oracle Version: 9.2.0.6.0
Application Server: windows2003
Develop tool : VC++;
Question:
when I get the return refcursor by OLEDB.Oracle, there is not any memory leak and work well. But when I change the driver to ODBC “Oralce in OraHome92"
there will be an 56k memory leak.
And in the other hand if I call an store precedure without return ref. Both driver /way can work well.
Can you give me the advice? thanks a lot.
Code such as:
_ConnectionPtr m_AdoConnection;
_CommandPtr pcmd = NULL;
_RecordsetPtr sp_rs = NULL;
_bstr_t bstrConstruct = _bstr_t("DSN=test;Uid=test;Pwd=test;PLSQLRSet=1");
HRESULT hr = CoCreateInstance(__uuidof(Connection),NULL,CLSCTX_INPROC_SERVER,__uuidof(_ConnectionPtr),(LPVOID *)&m_AdoConnection);
if (FAILED (hr) ) throw hr ;
m_AdoConnection->PutCursorLocation(adUseClient) ;
m_AdoConnection->IsolationLevel = adXactSerializable;
m_AdoConnection->Mode = adModeShareExclusive;
bstr_t bstrEmpty(L"") ;
m_AdoConnection->Open (bstrConstruct, bstrEmpty, bstrEmpty, -1) ;
SAFE_CALL(m_spObjectContext->CreateInstance(__uuidof(Command),__uuidof(_CommandPtr),(LPVOID *)&pcmd));
if(pcmd == NULL)
throw CAtlExceptionEx(E_POINTER,"pcmd is NULL");
pcmd->CommandText = _bstr_t(L"wec_pkg_spl.wec_proc_spl_check");
pcmd->CommandType = adCmdStoredProc;
_bstr_t id = _bstr_t("65650000");     
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"id"),DataTypeEnum(adVarChar),adParamInput,2000,_variant_t(id)));          
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errcode"),DataTypeEnum(adNumeric),adParamOutput,4));
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errdescription"),DataTypeEnum(adVarChar),adParamOutput,2000));
pcmd->ActiveConnection = sp_con.m_AdoConnection;
sp_rs = pcmd->Execute(NULL,NULL,adCmdStoredProc);
pcmd->Release;          
sp_rs->Close();     
if (m_AdoConnection->State == adStateOpen)
m_AdoConnection->Close();
wec_pkg_spl.wec_proc_spl_check arguments:
id          varchar2     in
flowpaths     ref cursor     out
errcode          number          out
errdescription     varchar2     out
Message was edited by:
[email protected]

I'm using the oracle ODBC driver 8.05.10 with MFC and client version 8.0.5. In my experience you can't prevent memory leaks with that or earlier versions of the ODBC driver. Client patchkits or service packs for NT or the Visual Studio doesn't solve the problem.
The following code will result in a memory leak with the oracle driver. With every expiration of the timer the leak will grow.
void CTestOdbcOracleDriverDlg::OnTimer(UINT nIDEvent)
TCHAR errString[255];
//open the database with class CDatabase
//use of CRecordset
TRY {
//my table name is AL_ALARME_LOG
pMyRecordset->Open(CRecordset::dynaset,"SELECT * FROM AL_ALARME_LOG",CRecordset::none);
//do something with the data
Sleep(0);
pMyRecordset->Close();
CATCH_ALL(error) {
error->GetErrorMessage(errString,255);
DELETE_EXCEPTION(error);
END_CATCH_ALL
CDialog::OnTimer(nIDEvent);
The same code with the Microsoft ODBC driver
doesn't cause memory leaks.
Andreas ([email protected])

Similar Messages

  • Why do I get a memory leak when I use the Write Data Storage VI in a loop

    I have a large application that I am collecting various data points from. For the most part they are simple scalar values that need to be logged on a regular basis.  I was attempting to use the new TDM files and the storage VI's  I though everything was working until I looked at the taskmanager and noticed that when the logging loop ran my CPU eventually went to 100% and the process memory grew from about 80,000K to 100,000K and eventually locks up the system. 
    I am using a state machine arch. 
    State 1 - open file (open create) mode) 
    State 2 - Write Channel Group Properties
    State 3 - Loop writes 24 distinct data points to a TDM files in append mode
    State 3 - Repeats [creating new rows of the same 24 data point (wait time about 1 sec)]
    State 4 - Close file on exit.
    Any help on this problem would be appreciated.

    The way I see it, it should be this way.
    Message Edited by Pana-man on 09-30-2005 08:15 PM
    Message Edited by Pana-man on 09-30-2005 08:18 PM
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?
    Attachments:
    nextWeek.jpg ‏43 KB

  • Memory leak when using database connectivity toolset and ODBC driver for MySQL

    The "DB Tools Close Connection VI" does not free all the memory used when "DB Tools Open Connection VI" connects to "MySQL ODBC Driver 3.51".
    I have made a small program that only opens and close the connection that I run continously and it's slowly eating all my memory. No error is given from any of the VI's. (I'm using the "Simple Error Handler VI" to check for errors.)
    I've also tried different options in the DSN configuration without any results.
    Attachments:
    TestProgram.vi ‏16 KB
    DSNconfig1.jpg ‏36 KB
    DSNconfig2.jpg ‏49 KB

    Also,
    I've duplicated the OPs example: a simple VI that opens and closes a connection. I can say this definately causes a memory leak.
    Watching the memory:
    10:17AM - 19308K
    10:19AM - 19432K
    10:22AM - 19764K
    10:58AM - 22124K
    Regards,
    Ken
    Attachments:
    OpenCloseConnection.vi ‏13 KB

  • Memory Leak when running Contacts

    I am having a big memory leak when running the app Contacts on a MB Air. It gobbles up 2 GB of ram in just a few minutes forcing a reboot. I have re-installed Mountain Lion 10.8.2 and it still leaks memory. Watching Activity Monitor shows the rapid increase in Ram being gobbled up by Contacts. Used Mackeeper to clear cache as well as ran Cocktail, all to no avail. Any tips would be greatly appreciated.

    The size of oracle.exe is not an indication of how the Java VM GC works; so you are not comparing apples to apples. It'll be too long to explain here but in my upcoming book (see hereafter), I gave a detailled explanation of the various memory areas the Java VM uses and how these are GCed and also how you can meausre their size (not all, though).
    In short you want to use OracleRuntime methods such as
    OracleRuntime.getSessionSize(); --> get he current size of Sessionspace
    OracleRuntime.getNewspaceSize(); --> get he current size of Newspace
    there are other memory areas described in the book
    http://www.oracle.com/technology/pub/articles/mensah_dws.html
    http://www.elsevier.com/wps/find/bookdescription.cws_home/706089/description#description
    Sample chapter: http://www.oracle.com/technology/books/pdfs/mensah_ch1.pdf
    Kuassi

  • App Memory Leak When Open iPhoto

    Hi everyone,
    Does anyone have experienced app memory leak when open iPhoto?  My free memory immediate dropped from 5000 mb to 15mb when I open iPhoto and the app never open.  If I force to quit iPhoto, all return to normal and everything work fine.  I only have iPhoto app running, not sure what caused the memory leak??? 
    Looking for help. 
    Thanks
    JHML

    Actually the new library was a test to see if the problem occurred only with your current library or with all libraries.  The fact that switching libraries cleared up the problem is just serendipitous. 

  • Memory leak when transferring files Lion

    hi all, help   I'm experiencing a memory leak since upgrading to Lion when transferring shared files between my macbook pro and imac. This occures through ethernet (wireless/wired) and firewire 800. No other apps are open except activity montior and finder. I am trying to transfer about 100g of itunes music / video files and pictures. Time machine backups to my TC do not have this affect.
    When transfer starts the free memory slowly decreases whilst the inactive memory increases. Eventually the free memory drops below 10mg, active memory is approx 5-6gb and wired/active is about 2gb. Bascially as the free memory decreases the inactive memory increases however does not get realocated so the mac grinds to a halt and dies with lots of page outs etc.
    this only happens when trying to transfer files. I have tried whole folders and just small individual ones and noticed the same event. I am struggling to find the cuase of the problem - any ideas?
    mac os x 10.7.1
    processor 2.53 GHz Intel Core i5
    Memory 8 GB 1067 MHz DDR3
    cheers, Kevin

    I dont think you have a memory leak. I think the problem is the xml file is 1000000 records long and takes up too much memory. Even if you find a way to increase memory size, you are loading down the server too much for other people's applications to run. I suggest instead reading up on xml and learning how to read in only a few records at a time, processing it, and getting the next set of records to process. There are two methods to parse an xml file using an xml parser, one is to parse it all and put it in memory, the other is to process one record at a time (an xml book explains it better).
    However, I question why you have reports that are 1000000 records long. end-users cannot effectively use such records (you cant scroll through 1000000 records). I suggest finding a way to greatly decrease the number of records in each file such as by providing just the records a particular user needs to do his job and not all records. For instance, put a textfield on his screen to let him only fetch records within a certain date range.
    Lastly, I suggest putting your code in a try/catch/finally block where the finally block actually closes the objects. Example:
    finally{
    if(conn!=null)
    conn.close();
    }

  • Memory leak when transferring pdf...help needed

    Dear All,
    I'm a newbie in developing java app. I'm making a web based application in reporting using JSP. java 1.6.02, jasper report 204, i-report 2.0.0
    Client : OS : Win xp, memory 512MB
    Server : Tomcat 6.0
    DB Server : SQL Server 2005
    OS Server : Windows Server 2003, memory 1GB
    Report spec : .pdf based, with up to 1million record
    Here's the code :
    String query;
            try {
            String filereport = request.getRealPath("division/accounting/template/POReport.jrxml");
            InputStream input = new FileInputStream(filereport);
            Class.forName(odbcDriver);
            Connection conn = DriverManager.getConnection(odbcURL,username,passwd);
            ResultSet rset = null;
            CallableStatement cs = null;
            query = "{ call sp_tpo_list }";
              cs = conn.prepareCall(query);
              rset = cs.executeQuery();
            JRDataSource dataSource = new JRResultSetDataSource(rset);
            JasperDesign design = JRXmlLoader.load(input);
            JasperReport report = JasperCompileManager.compileReport(design);
            JasperPrint print = JasperFillManager.fillReport(report, null, dataSource);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            JasperExportManager.exportReportToPdfStream(print, baos);
            response.setContentType("application/pdf");
            response.setContentLength(baos.size());
            ServletOutputStream sos;
            sos = response.getOutputStream();
            baos.writeTo(sos);
            sos.flush();
            rset.close();
            cs.close();
            conn.close();
            sos.close();
            baos.close();
            input.close();      
            catch (FileNotFoundException fe) {}
            catch (JRException jre) {}
            catch (ClassNotFoundException cnfe) {}
            catch (SQLException sqle) {} 
            catch (IOException ioe) {}I've already increase heap memory in Tomcat Manager -Xms 64Mb -Xmx 512Mb.
    But when i test with 1million record, out of heap memory error is coming out.
    When i test with 500.000 record, it work out, but only when 1 client access. More than 1 client, out of heap memory error generated by the system.
    How can this happen? How can i detect memory leaks occured in the program?
    And pls let me know if you see something is missing in the code above.
    Thank you

    I dont think you have a memory leak. I think the problem is the xml file is 1000000 records long and takes up too much memory. Even if you find a way to increase memory size, you are loading down the server too much for other people's applications to run. I suggest instead reading up on xml and learning how to read in only a few records at a time, processing it, and getting the next set of records to process. There are two methods to parse an xml file using an xml parser, one is to parse it all and put it in memory, the other is to process one record at a time (an xml book explains it better).
    However, I question why you have reports that are 1000000 records long. end-users cannot effectively use such records (you cant scroll through 1000000 records). I suggest finding a way to greatly decrease the number of records in each file such as by providing just the records a particular user needs to do his job and not all records. For instance, put a textfield on his screen to let him only fetch records within a certain date range.
    Lastly, I suggest putting your code in a try/catch/finally block where the finally block actually closes the objects. Example:
    finally{
    if(conn!=null)
    conn.close();
    }

  • Memory Leak when TOMCAT connects to Oracle 10g RAC using JDBC Thin driver.

    We had experienced Memory leak when a Oracle 10g (10.2.0.3) RAC node was evicted. TOMCAT app server is connecting to the Oracle 10g RAC database instances using JDBC 10.2.0.3 thin driver.
    Anyone had similar experience?
    Any ideas? Any bugs reported/fixed?
    Thanks,
    Raj

    If you're doing XA, we absolutely do not support
    driver-level load-balancing OR failover. Use neither.
    For non-XA, you can use driver-level failover. For
    non-XA, you could set load-balancing, but it won't
    help because we get connections from the driver,
    and keep them indefinitely, so the driver never gets
    the chance to affect which connections the pool
    uses after that.

  • How to get the values returned by a function in a drop down?

    Hi All,
    Can anyone please help in getting the values returned by a function into a drop down? I have a java class file where in i have written a function called getWeeks() which give all the week dates and i want to display these week dates in a drop down box in a JSP page.
    Please help me in this regard.
    Thanks in Advance!!
    Lakshman.

    Hi Lakshman,
    the following code can help you do what you want :
    <hbj:dropdownListBox id="calendar" tooltip="Calendar" selection="<%= selected %>">
    <%
    String[] weeks = myObjectBean.getWeeks();
    for (int i = 0; i < weeks.length; i++) {
    %>
         <hbj:listBoxItem key="<%= i %>" value="<%= weeks<i> %>"/>
    <%
    %>
    </hbj: dropdownListBox>
    The <%= selected %> snippet allows you to pre-select one of the options (provided that the variable 'selected' is equal to one of the listBoxItem keys).
    You can also add onSelect to the tag (e.g. = "setSelectedItem"). It corresponds to a method in the corresponding JSPDynPage class. This means that when you select another item in the dropdown list, the method in your Java class is performed (allowing you to save the selected value and performing actions with it)
    I hope this helped you enough,
    kind regards,
    Frederic
    Edited seven times by: Frederic Taes on Nov 5, 2008 11:24 AM -> the onSelect element was in the hbj tag and in the text with "='setSelectedItem'" next to it and when I tried to post my message, I got a 501 error all the time ! Seems like a SDN bug to me ...

  • Memory leak when using Threads?

    I did an experiment and noticed a memory leak when I was using threads.. Here's what I did.
    ======================================
    while( true )
         Scanner sc = new Scanner(System.in);
         String answer;
         System.out.print("Press Enter to continue...");
         answer = sc.next();
         new TestThread();
    ========================================
    And TestThead is the following
    ========================================
    import java.io.*;
    import java.net.*;
    public class TestThread extends Thread
    public TestThread() { start(); }
    public void run() {  }
    =====================================
    When I open windows Task Manager, every time a new thread starts and stops, the java.exe increases the Mem Usage.. Its a memory leak!? What is going on in this situation.. If I start a thread and the it stops, and then I start a new thread, why does it use more memory?
    -Brian

    MoveScanner sc = new
    Scanner(System.in);out of the
    loop.Scanner sc = new Scanner(System.in);
    while (true) {
    That won't matter in any meaningful way.
    Every loop iteration creates a new Scanner, but it also makes a Scanner eligible for GC, so the net memory requirement of the program is constant.
    Now, of course, it's possible that the VM won't bother GCing until 64 MB worth of Scanners have been created, but we don't care about that. If we're allowing the GC 64 MB, then we don't care how it uses it or when it cleans it up.

  • Results from a form submission does not keep the fields in order when I get the email

    I created a form and it works fine but when I get the email
    back the fields are out of the tab order or out of wack meaning
    they are not in order that I set the acceptabilities to.
    Is this something in the Action script I have to add and what
    would it look like or do I need to edit the CGI script?
    I can provide a link or script let me know.
    Thanks

    This is action script 3.0 Flash CS3
    Below is what I receive back after I test it but it is not in
    order. I guess I assumed that if the tab order is correct and the
    are layout in that order and the code in the form is in order it
    would come back the same way. Mostly I am trying to narrow down the
    problem and my guess is the cgi script or am I wrong? I have
    attached the code for the form.
    Thank You for you time
    Form email submission results:
    Below is what you submitted on Tuesday, February 19, 2008 at
    10:35:08
    list:
    phone:
    address:
    comments:
    city:
    state:
    zip:
    name:

  • I'm wanting to use the "Actions" in Photoshop Elements 11.  But when I get the Actions box up, it is only showing a small list of effects to use.  And no side bar to go any further.  When I click on the little arrow at top and then click on "load actions"

    I'm wanting to use the "Actions" in Photoshop Elements 11. But when I get the actions box up, it is only showing a small list of effects to use. And no side bar. So I can't go any further.  When I click on the little arrow at top and click on "load actions", I am only getting a box with empty space saying "No items match your search".  The folder at the top does say "Actions".  How do I get more effects?  The tutorials that I've checked into all show a long list of effects in their box.  Can anyone help? 

    To use the existing actions, try the following:
    1. Open one of the Action Sets, in this example Special Effects is the Action Set, by pressing the small arrow beside the set name.
    2. Then click on the name of the Action, in this example Faded Ink is the Action name.
    3. Then press the Play button to run the action.

  • How do I get my videos to upload from my sony handy cam when I get the message The following file could not be imported.  The file is in an unrecognized format. I am using a macbook pro version 10.9.3, I have 411 gb free space, it worked before I updated

    How do I get my videos to upload from my sony handy cam when I get the message The following file could not be imported.  The file is in an unrecognized format. I am using a macbook pro version 10.9.3, I have 411 gb free space, it worked before I downloaded the latest update for iphoto.

    You may be able to download and install the update from here: Digital Camera RAW Compatibility 6.01
    If I upgrade to Yosemite will I be forced to go to the new Photos program
    No. After upgrading (and of course make a back up first) you will need to update iPhoto to v9.6.1 (you won't be able to do this prior to upgrading). Here's how:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.
    Photos is v1 of a new app, as yes it's not as mature as iPhoto. It uses a different technology for working with external editors. That requires Adobe to write an extension to let it hook into the new app. Not done yet, neither has anyone else.
    Going forward: iPhoto will run on OS 10.10., but there is no guarantee for subsequent versions of the OS. You might want to factor that into your anger term thinking.

  • What do I do when I get the message my printer is not connected? HP Officejet Pro 8500A e-All-in-One

    What do I do when I get the message my printer is not connected when I want to print wirelessly.? HP Officejet Pro 8500A e-All-in-One.  I have a macintosh computer using snow leopard.  I have used the printer for 6 months.  Nothing has changed.  I shut off the printer and turned it on.  The internet is working altough I will turn it off and on.  What do I do next?  Thank you.

    The easiest and fastest thing for you is to reset the printer to its defaults and then just install the printer again following the instructions in the manual when you received it.  If you don't have these you will find this on the HP web site.
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • I forgot the answers to the security questions. When I get the screen with security questions to be answered, the email adress where the reset procedure is sent to is wrong. How do I change it?

    I forgot the answers to the security questions. When I get the screen to answer them, the email address listed to send the email procedure is wrong. How do i change this email address?

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
    Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                             Apple ID- All about Apple ID security questions.

Maybe you are looking for

  • Tax condition types issue in sales order

    Hi Friends, I am bit lost with the following issue. I have searched sdn and other SAP forums for this. There were similar issues discussed but they didnu2019t solve my issue. There was exactly similar issue but it was unanswered. So I am posting the

  • Can I install Tiger on external drive with OS9 on internal?

    I bought and plan to install OS X 10.4.3, but will continue to use OS 9.2.2 about 95% of the time because I can't afford to update all 3rd-party software at this time, so I want to start up in 9.2.2 usually. Can I install 10.4.3 on a partition of my

  • Flash Builder 4.7 startup error: Exception in com.adobe.flexbuilder.ui.UIPlugin.start() of bundle...

    I installed Flash Builder Premium 4.7. The installation was successful but when I am running flash builder, it is giving me a startup error and some of the contents of log file is given below. Can anyone help me resolve this issue? Thanks! !SESSION 2

  • Issue with program - SF_XSF_DEMO_MAIL

    Hi Gurus, I did not get any answer for the previous post on the same topic,but with different subject. Hence posting it again with a straight forward question. I am tryng to incorporate the functionality explained in the SAP standard and demo program

  • Static on my cordless phones

    I am lacking in knowledge about my new router. I have several cordless phones in my home. Right now there is an annoying amount of static interference on the phone while in use. Is this noise caused by the router in some way? If so what is my solutio