Huge Memory Leak, CPU Usage

We are noticing in several of our apps a very bad memory
leak. See the below code. Its called every 100ms to process any
messages as we use this like a queue system. Overnight, not a
single message was sent...as the app was just sitting idle on my
screen. My server log confirm this, not a single post was done.
However, memory usage jumped 300MB, and by the end of today, my
browser is going to crash when it runs out of memory.
The memory leak seems to be directly related to the
setTimeout function, as that is the only thing being called
here...there was nothing put on the queue all night.
Specifically, Iw as at roughly 50MB of memory usage yesterday
afternoon. After a bunch of testing, the memory usage was up to
175MB. Overnight we are now over 475MB. This is the internal memory
used by Flash, and my Activity monitor confirms this.
This issue happens on OS X, and Windows XP, Flash 9 and Flash
10. In 3 different application we have that do this sort of queue
setTimeout loop.
Anyone else seeing this?
How can I work around this?
Thanks,
Ben

"Ben Spink" <[email protected]> wrote in
message
news:gonn46$afd$[email protected]..
> How would either of those resolve the issue?
AFAIK, there are no inbuilt memory leak problems with using
an enterFrame
event handler. LiveCycle Data Services will push the
information to you, so
you don't have to constantly try to pull, so to speak..
> I'm just looking for a fast timer situation that is
polling my queue for
> any
> requests that need to be sent.
>
> More importantly...why does this issue exist? Why hasn't
this issue been
> fixed...it seems its been around for quite some time.
It's possible that it's not Flex, but you. Are you constantly
adding event
listeners without removing them? Are you removing objects
from the stage
without removing all references to them?
> I can't leave my browser open in the background if I
have a flex app open.
> Its going to hang my browser and system...as its already
done during a a
> live
> demo to a customer.
>
> There are other bugs, and I can excuse them, but
something as basic as
> this
> creating a memory leak is really terrible.
I wouldn't be so quick to blame Flex. You have to make sure
you clean up
after yourself, or you can cause these types of issues with
your code.

Similar Messages

  • Firefox 17 huge memory leak

    Since the last update today, Firefox seems to got a huge memory leak. After one hour idle on some pages it was up to 750MB memory usage, and constant 100% load of one CPU core.
    Looks like something is not going well with the garbage collection, if I visit http://www.robertsspaceindustries.com/forums/forum/forum-category-2/ for example.
    Had to disable the graphic hardware acceleration, because of the newly introduced "clear type" font bug.
    Edit: May also be related to mail.google.com, which I have running in an app tab.

    For what it's worth, I had exactly the same problem (except that it's on Linux) since the upgrade to 17.0. When I disabled greasemonkey, the problem instantly disappeared, so it looks like the compatibility with greasemonkey got broken.
    Likewise, I'm very disappointed with the frequent bugs/annoyances that come with the rolling upgrade system; I find myself more and more using Chromium because of it. Mozilla really needs to give people the option to run a stable branch that receives security updates only.

  • Firefox 4.0 RC has huge memory leak + slow down problem

    Firefox 4.0 RC Seems to have a huge memory leak issue. After leaving the program open for around half an hour the RAM usage climbs to over 1 gb.
    However, I have 12 gb of physical ram, so firefox staking 1 gb for itself is not too big of a problem (and is probably a blessing as it means it's caching more data), but the problem is that the UI begins to slow down and become clunky after about 30 minutes.
    Browsing, switching tabs, even typing becomes jittery and not very responsive.
    This happens regardless of how many tabs I have open.
    Now it's also crashing every once in a while.

    Even with Firefox 4.0 (Release) running in Safe Mode, with all add-ons and themes disabled, I'm still inclined to think there's something screwy going on here.
    I was watching Page Faults/sec, Page File Bytes and Working Set in Performance Monitor and tailing the Privoxy log for requests. Even with Firefox minimized and "doing nothing" (making no requests, anyway), over the space of a 10 minute period the Working Set grew from 244,375,552 bytes to 274,939,004 bytes (averaging 50,939 bytes/second). This behaviour doesn't seem consistent though - sometimes it doesn't seem to grow at all.
    Additionally the Page Faults/Sec went nuts, accompanied by a step in Page File Bytes and Working Set, whenever a request got made to http://safebrowsing.clients.google.com/safebrowsing/downloads which seems to happens on a regular basis (approximately every 30 minutes).

  • Huge Memory Leak - Need help.

    Hi,
    There is a huge memory leak in our application. Because of this there are frequent session timeout. When we analysed the heap dump using Memory Analyser Tool, we got the leak suspects and the problem suspects are as below:
    One instance of "org.apache.jasper.compiler.JspRuntimeContext" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupies 161,832,200 (23.30%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>".
    One instance of "org.apache.catalina.tribes.tipis.LazyReplicatedMap" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupies 133,578,920 (19.23%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>".
    185 instances of "org.apache.jasper.runtime.BodyContentImpl", loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupy 133,502,776 (19.22%) bytes.
    What could be the root cause for this error and how to resolve this?

    First, in general you not provided enough details to get any help. OS? OS version? Hardware specifics?
    Second, are you running custom code? If so, post it so you can get help.
    Third, if you're not running custom code, the odds of you having a "huge memory leak" are pretty small.

  • HUGE memory leak when using MP3

    I downloaded a new FME 2.0 and noticed they added an option
    to stream in MP3 format. DO NOT USE that mode (!). If you start
    streaming in MP3 format you will get a huge memory leak on the
    client side. Your browser starts eating memory like crazy and it
    will bury your machine withing an hour or two by taking all the
    memory available. I have proved it on several machines, notifed
    Adobe. They confirmed it as a bug and promised to fix in the future
    releases. Nice, huh? and what people are supposed to do with the
    current build?

    A new build 2.0.1.1114 has been posted . Please try and let
    us know if you face this issue with this build.

  • How to check the memory and CPU usage on NPU

    Hi expert ,
    Could you tell me how to check the memory and cpu usage on NPU?
    I think ASR1000 has this command (show platform hardware qfp active...) , but I coudn't find the same command on ASR9001.
    I checked " show controllers np counters all"  command, but I did not find it.
    Platform: ASR9001
    version: 4.3.2
    NP: Tyhoon
    Thanks,

    Hi Kanako,
    understand your question, but something like that doesnt exist for the trident/typhoon NPU's for the asr9k.
    in fact cpu usage is not really applicable for parallel/serialized hardware forwarders, but mainly the KPI is here
    the PPS it handles.
    The max pps it can handle is dependent on feature set.
    What you could do is measure the rates on the PARSE_FABRIC_RECEIVE count (packets received from fabric, so egress direction), PARSE_ENET_RECEIVE count (packets received from the interface to the fabric, so ingress) and the LOOPBACK count, that is packets that are recirculated for extra processing. The sum of these 3 gives an idea of the PPS rate the NPU is working on.
    Memory consumption is something tricky also, there are many memories attached to the NPU, notably:
    TCAM used for vlan matching, ACL and QOS matching
    Search memory for L2 and L3 (shared on Trident, separated on Typhoon)
    Frame memory for packet bufferin in QOS
    Stats memory, for all kinds of counters of QOS maps, interface stats etc
    their usage is rather dynamic also.
    The few things you want to verify on these are:
    - ACL usage (in terms of Tcam entries)
    - MAC table size (2M max on typhoon)
    - FIB size (4M max on typhoon)
    frame memory is dependent on the buffering, which is a sum of all the packets instant queue length and size of all pmaps attached to interfaces served by the same NPU. there is no good overview as to how much you have available of that, but it has a rather significant size 1G or 2G depending on the TR or SE cards (typhoon specific).
    regards
    xander
    Xander Thuijs CCIE #6775
    Principal Engineer 
    ASR9000, CRS, NCS6000 & IOS-XR

  • Huge memory leaks in using PL/SQL tables and collections

    I have faced a very interesting problem recently.
    I use PL/SQL tables ( Type TTab is table of ... index by binary_integer; ) and collections ( Type TTab is table of ...; ) in my packages very widely. And have noticed avery strange thing Oracle does. It seems to me that there are memory leaks in PGA when I use PL/SQL tables or collections. Let me a little example.
    CREATE OR REPLACE PACKAGE rds_mdt_test IS
    TYPE TNumberList IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    PROCEDURE test_plsql_table(cnt INTEGER);
    END rds_mdt_test;
    CREATE OR REPLACE PACKAGE BODY rds_mdt_test IS
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    END;
    END rds_mdt_test;
    I run the following test code:
    BEGIN
    rds_mdt_test.test_plsql_table (1000000);
    END;
    and see that my session uses about 40M in PGA.
    If I repeat this example in the same session creating the PL/SQL table of smaller size, for instance:
    BEGIN
    rds_mdt_test.test_plsql_table (1);
    END;
    I see again that the size of used memory in PGA by my session was not decreased and still be the same.
    The same result I get if I use not PL/SQL tables, but collections or varrays.
    I have tried some techniques to make Oracle to free the memory, for instance to rewrite my procedure in the following ways:
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    x.DELETE;
    END;
    or
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    FOR indx in 1 .. cnt LOOP
    x.DELETE(indx);
    END LOOP;
    END;
    or
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    x TNumberList;
    empty TNumberList;
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    x(indx) := indx;
    END LOOP;
    x := empty;
    END;
    and so on, but result was the same.
    This is a huge problem for me as I have to manipulate collections and PL/SQL tables of very big size (from dozens of thousand of rows to millions or rows) and just a few sessions running my procedure may cause server's fall due to memory lack.
    I can not understand what Oracle reseveres such much memory for (I use local variables) -- is it a bug or a feature?
    I will be appreciated for any help.
    I use Oracle9.2.0.1.0 server under Windows2000.
    Thank you in advance.
    Dmitriy.

    Thank you, William!
    Your advice about using DBMS_SESSION.FREE_UNUSED_USER_MEMORY was very useful. Indeed it is the tool I was looking for.
    Now I write my code like this
    declare
    type TTab is table of ... index binary_integer;
    res TTab;
    empty_tab TTab;
    begin
    res(1) := ...;
    res := empty_tab;
    DBMS_SESSION.FREE_UNUSED_USER_MEMORY;
    end;
    I use construction "res := empty_tab;" to mark all memory allocated to PL/SQL table as unused according to Tom Kyte's advices. And I could live a hapy life if everything were so easy. Unfortunately, some tests I have done showed that there are some troubles in cleaning complex nested PL/SQL tables indexed by VARCHAR2 which I use in my current project.
    Let me another example.
    CREATE OR REPLACE PACKAGE rds_mdt_test IS
    TYPE TTab0 IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    TYPE TRec1 IS RECORD(
    NAME VARCHAR2(4000),
    rows TTab0);
    TYPE TTab1 IS TABLE OF TRec1 INDEX BY BINARY_INTEGER;
    TYPE TRec2 IS RECORD(
    NAME VARCHAR2(4000),
    rows TTab1);
    TYPE TTab2 IS TABLE OF TRec2 INDEX BY BINARY_INTEGER;
    TYPE TStrTab IS TABLE OF NUMBER INDEX BY VARCHAR2(256);
    PROCEDURE test_plsql_table(cnt INTEGER);
    PROCEDURE test_str_tab(cnt INTEGER);
    x TTab2;
    empty_tab2 TTab2;
    empty_tab1 TTab1;
    empty_tab0 TTab0;
    str_tab TStrTab;
    empty_str_tab TStrTab;
    END rds_mdt_test;
    CREATE OR REPLACE PACKAGE BODY rds_mdt_test IS
    PROCEDURE test_plsql_table(cnt INTEGER) IS
    BEGIN
    FOR indx1 IN 1 .. cnt LOOP
    FOR indx2 IN 1 .. cnt LOOP
    FOR indx3 IN 1 .. cnt LOOP
    x(indx1) .rows(indx2) .rows(indx3) := indx1;
    END LOOP;
    END LOOP;
    END LOOP;
    x := empty_tab2;
    dbms_session.free_unused_user_memory;
    END;
    PROCEDURE test_str_tab(cnt INTEGER) IS
    BEGIN
    FOR indx IN 1 .. cnt LOOP
    str_tab(indx) := indx;
    END LOOP;
    str_tab := empty_str_tab;
    dbms_session.free_unused_user_memory;
    END;
    END rds_mdt_test;
    1. Running the script
    BEGIN
    rds_mdt_test.test_plsql_table ( 100 );
    END;
    I see that usage of PGA memory in my session is close to zero. So, I can judge that nested PL/SQL table indexed by BINARY_INTEGER and the memory allocated to it were cleaned successfully.
    2. Running the script
    BEGIN
    rds_mdt_test.test_str_tab ( 1000000 );
    END;
    I can see that plain PL/SQL table indexed by VARCHAR2 and memory allocated to it were cleaned also.
    3. Changing the package's type
    TYPE TTab2 IS TABLE OF TRec2 INDEX BY VARCHAR2(256);
    and running the script
    BEGIN
    rds_mdt_test.test_plsql_table ( 100 );
    END;
    I see that my session uses about 62M in PGA. If I run this script twice, the memory usage is doubled and so on.
    The same result I get if I rewrite not highest, but middle PL/SQL type:
    TYPE TTab1 IS TABLE OF TRec1 INDEX BY VARCHAR2(256);
    And only if I change the third, most nested type:
    TYPE TTab0 IS TABLE OF NUMBER INDEX BY VARCHAR2(256);
    I get the desired result -- all memory was returned to OS.
    So, as far as I can judge, in some cases Oracle does not clean complex PL/SQL tables indexed by VARCHAR2.
    Is it true or not? Perhaps there are some features in using such way indexed tables?

  • Huge memory leaks after upgrading from kernel 2.6.38(?)

    My system began leaking memory some months ago and I've little to no idea what is causing it. The closest hint I can give is that I think these problems started around upgrading from Linux 2.6.38 to 2.6.39 and have continued with 3.0 aswell. Sometimes my whole system freezes due to extensive swapping (HDD usage led stays lit), sometimes it stops after consuming almost all of my 4 GB RAM.
    I think the leak has to come from inside the kernel because all sysmon apps claim no application is eating too much RAM yet the system memory consumption is at 100 % or even using swap. Even after I kill Xorg the memory usage will stay at least at 2.0 GB, when it should be less than half a gig.
    I'd like to guess the blame is on Nouveau, because it was giving me a hell of a time back with Linux 2.6.39. It had a habit of freezing my system when re-enabling suspended compositing (both with Kwin and Mutter). Also video playback was corrupted sometimes. These probs have since been fixed with Linux 3.0.
    I cannot name any spesific app that might trigger this memory leaking. I don't play any games and mainly use Firefox, Chromium and VLC day in, day out.
    There seems to be absolutely no way of reclaiming the reserved memory than rebooting the whole system. I have even tried unloading Nouveau.
    I am currently running the [testing] repo with ~daily upgrades.
    Last edited by Verge (2011-08-16 14:04:09)

    OK, this kind of surprised me. No wonder I couldn't find any relevant stuff while googling for kernel issues. I have had Strigi disabled for some time now because it is miserably broken, but I now disabled the whole Nepomuk too. Let's see if my problem now goes away or what...
    The release of KDE 4.7 Beta 1 actually lines up with the launch of Linux 2.6.39 so this really might be the case. I moved to KDE 4.7 already with the first beta.
    Last edited by Verge (2011-08-16 14:30:37)

  • Huge memory leak when closing PDF from Hyperlink

    I was wondering if anyone else has experienced this issue with Adobe Reader 11.0.10 on Windows 7 64bit:
    1. I have a list of hyperlinks in an Access Table to certain PDF files on a local network folder.
    2. Clicking the hyperlink opens the corresponding PDF.
    The PDF file opens just fine, and renders normally. The issue is when I attempt to close the PDF. This results in an instant Memory leak that will grow to 4GB in under 10 seconds. System crashes completely. I can reproduce the crash in Safe Mode as well. I am able to open/close the PDF from its source location normally without incident. Clean Uninstall/Reinstall produces the same results.
    Downgrade to Adobe 10 fixes the problem completely. I can reproduce the problem on all computers on my network (all running windows 7 32bit or 64bit) by upgrading to Reader 11.0.10.
    I prefer to keep my software updated to prevent vulnerabilities, so any help would be appreciated.

    That is very strange because it is a 32-bit program and cannot (according to popular wisdom) grow over 2 GB. Also, if it were to reach 2 GB it would simply crash, not break the system.
    Do you have a screen shot showing the 4 GB? There might be clues there what is happening.

  • Huge memory leak in java jvm after update 2 for Snow leopard

    Since I updated to Java Update 2 for Snow Leopard my JVM suddenly grows massive (10GB+ real memory - -Xmx=3500m) consuming all memory and rendering my iMac unusable. This does not happen predictably but does happen several times a day now requiring I power off and on again.
    I had been living happily with update 1 with no such problem.
    I need to either go back to update 1 (should have it on Time Machine) or find a solution for this problem.

    Our application is a j2ee-based commercial application facing to specified customers, having about 120 access request an hour.
    We ' re doing stress test on the test server. The strange memory leak occurs at 1:20 am this morning while we're out of company , and no job was scheduled to run at that time. So I have the tendency to image that there is something inside oc4j had occured.
    I have used OptimizeIt to monitor the heap status. However , as the memory leak problem occurs very occasionally ,and that tool deadly slows our server, we are currently using no profiling tools.

  • Suddenly, I'm getting a huge memory leak

    Since somewhere in Firefox version 36 and continuing to the present (ver 37.0.1), I am getting a major memory leak. I am using Mac OS 10.9.5. And this is what I've done so far: reduced the number of tabs (now at about 4 or 5). Have a minimal amount of plugins and extensions. Maybe 5. I've reset Firefox but the leak still occurs.
    This happens when I leave Firefox open overnight. It's only been happening for about the last month. In the morning I find that all my apps have been paused for lack of memory. Looking at the activity monitor I see that my kernel_task is using 9.5GB of memory (when it should be about 1GB). Quitting Firefox solves the problem. But this has never happened before.
    Also, sometimes Firefox will crash saying the Shockwave plugin quit. I have updated to the latest Flash plugin but it still happens.

    The three Add-ons you mentioned are extensions (Firefox/Tools > Add-ons > Extensions).
    Note that an extension like Firefox bug can cause issues with memory leaks.
    If it works in Safe Mode and in normal mode with all extensions (Firefox/Tools > Add-ons > Extensions) disabled then try to find which extension is causing it by enabling one extension at a time until the problem reappears.
    Close and restart Firefox after each change via "Firefox > Exit" (Windows: Firefox/File > Exit; Mac: Firefox > Quit Firefox; Linux: Firefox/File > Quit)
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    You can try to close the browsing area and only leave the menu bar visible to see if the leak still happens.
    What I meant above was plugins like Flash or Java (Firefox/Tools > Add-ons > Plugins) that might be used on tabs if you keep the browsing area open with some tabs with web pages.
    *https://support.mozilla.org/kb/Troubleshooting+plugins

  • Huge Memory Leak - Simple To Reproduce

    I have an application that updates the display every so often using a timer, and as I run the application it comsumes increasingly more memory. After some extensive effort I narrowed it down to a very simple scenario:
    The code below creates a 40x30 matrix of objects that extend UIComponent (the same problem exists if I extend Sprite). A timer fires every 3 seconds and repaints each object with a random color on updateDisplayList(). Running this (whether from Flex IDE or swf) produces an infinitely increasing memory leak, even though no new memory should be allocated on each timer event. I see an increase of roughly .5MB to 1MB with each call. Calling gc() explicitly (which I know I shouldn't) doesn't help. I'm using Flex Builder 3.
    What am I missing? Is this a known bug? Any comment would be greatly appreciated.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="startUp();" horizontalAlign="left">
        <mx:Script>
            <![CDATA[
             private var _myUIObjects:Array = new Array();
                private var _timer:Timer = new Timer(3000);
                private function startUp():void
                 var myUIObject:MyUIObject;
                 for (var i:int = 0; i < 1200; i++) {
                  myUIObject = new MyUIObject();
                  _myUIObjects.push(myUIObject);
                  canvas.addChild(myUIObject);
                 for (var iRow:int = 0; iRow < 30; iRow++) {
                  for (var iCol:int = 0; iCol < 40; iCol++) {
                   myUIObject = _myUIObjects[iRow * 40 + iCol];
                   myUIObject.x = iCol * 18;
                   myUIObject.y = iRow * 18;
                   myUIObject.width = 15;
                   myUIObject.height = 15;
                  _timer.addEventListener(TimerEvent.TIMER, handle_timer);
                  _timer.start();
                private function handle_timer(event:Event):void
                 for (var i:int = 0; i < 1200; i++) {
                  MyUIObject(_myUIObjects[i]).invalidateDisplayList();
            ]]>
        </mx:Script>
        <mx:Canvas id="canvas" width="1000" height="1000"/>
    </mx:Application>
    package
    import mx.core.UIComponent;
    public class MyUIObject extends UIComponent
      protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
       this.graphics.beginFill(Math.random() * 500000);
       this.graphics.drawRect(0,0,15,15);

    You are missing a call to graphics.clear().  Your code is actually adding
    another fill on top of previously existing fills.

  • Huge Memory Leak!

    I know there has been lots of discussion on the forum about leaks, but I've got a big one and it's not even an add on.  I've got an executable that uses the DI.  I use a recordset to select the code field for virtually all the 7,000 BOMs in OITT.  I attach the recordset to the product tree object's browser to be able to loop through each bom, using the b1 object, like this:
                    'get all boms that aren't templates (Cindy says to include those where U_xxdslsty is null or blank)
                    sql = "select code from oitt where code  in (select itemcode from oitm where coalesce(U_xxdslsty,'') <> 'T')"
                    miscrs = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                    miscrs.DoQuery(sql)
                    If Not miscrs.EoF Then
                        bom = oCompany.GetBusinessObject(BoObjectTypes.oProductTrees)
                        bom.Browser.Recordset = miscrs
                        Do While Not bom.Browser.EoF
                            Try 'pgm has failed on move next !!!
                                'update bom line items' price list & unit price; update bom header pricelist too
                                SetBomToMCL(bom, MCLPriceList)
                                bom.Browser.MoveNext()
                            Catch ex As Exception
                                mReturnStatus.RtnCode = -1
                                mReturnStatus.RtnMessage = "Failing inside browser loop: " & ex.ToString
                            End Try
                        Loop
                    End If
    Inside that loop, I'm calling SetBomToMCL(bom, MCLPriceList) which receives the bom object byref & then changes the price list code on all the components, using a different record set to get the price on each component & then updates the price on the line item in a loop.  I also update the bom price using the Items object.  When I'm all done in that sub, I do release the com object stuff everyone recommends (for all the b1 objects used):
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oItm)
                    oItm = Nothing
                    gc.collect
    before returning to the main proc to read another row.  It is still chewing up memory "like there is no tomorrow".  It's about halfway through the boms & it's up to 1.2 Gigs!  As I step through in debug mode, it's interesting that the lines of code where I loop through the oitm.pricelist to find the correct one to update, memory usage seems to go up on each line of code:
                                        For a As Integer = 0 To oItm.PriceList.Count - 1
                                            oItm.PriceList.SetCurrentLine(a)
                                            If oItm.PriceList.PriceList = MCLPriceList Then
                                                oItm.PriceList.Price = TotalPrice
                                                oItm.PriceList.Currency = "$"
                                                Exit For
                                            End If
    Does anyone have any idea what I am doing wrong?  Desperate for help - THANK YOU!
    Edited by: John Chadwick on Aug 28, 2008 2:59 PM

    The proc is below. It does seem to take more memory for every iteration of the pricelist loop for the OITM object & that memory never seems to free up.  I've never heard any talk about releasing "sub-objects" via the ReleaseComObject command, but should I be doing something like this?
    System.Runtime.InteropServices.Marshal.ReleaseComObject(oItm.Pricelist)
    oItm.Pricelist = nothing
    System.Runtime.InteropServices.Marshal.ReleaseComObject(oItm)
    oItm = nothing
    I wouldn't think so, but who knows.
    Actually, when debugging & watching the memory changes, the ReleaseComObject command, and setting the object to nothing has no immediate affect on memory, nor does the gc.collect, for that matter - I usually wait a minute for the gc. to do something.  It really seems that anytime I read a record from a set, anywhere, it gobbles more memory (understandable) but never let's go.
    Also,  I don't know if I'd be better off using only one recordset in this sub, or making it/them global variables that I only instantiate once in the constructor?  It seems to me that I've gotten NullReference exceptions in other code when the recordset object is used after a period of inactivity, even if it is a global variable that has been instantiated (only once).
    Private Sub SetBomToMCL(ByRef BOM As ProductTrees, ByVal MCLPriceList As Short)
            Dim sql As String
            Dim rs, miscrs As Recordset
            Dim price, TotalPrice As Double
            Dim parent As String
            Dim pricelistfail As Boolean
            Try
                parent = BOM.TreeCode
                rs = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                For x As Integer = 0 To BOM.Items.Count - 1
                    BOM.Items.SetCurrentLine(x)
                    BOM.Items.PriceList = MCLPriceList
                    sql = "select price from itm1 where itemcode = '" & BOM.Items.ItemCode & "' and pricelist = " & MCLPriceList
                    rs.DoQuery(sql)
                    If Not rs.EoF Then
                        price = rs.Fields.Item("price").Value
                        BOM.Items.Price = price
                        BOM.Items.Currency = "$" ' needed when the component has a zero price on the line before the change
                        TotalPrice += (BOM.Items.Price * BOM.Items.Quantity)
                    Else
                        logfile.WriteLogRecord(mReturnStatus.ToString)
                        Exit Sub
                    End If
                Next
                Dim retval As Integer = BOM.Update
                If retval <> 0 Then
                    logfile.WriteLogRecord("BOM " & BOM.TreeCode & " not updated: " & vbCrLf & vbTab & mReturnStatus.ToString)
                Else
                    'update the price list on the header record 'by hand' because field is not exposed.
                    sql = String.Format("update oitt set pricelist = {0} where code = '{1}'", MCLPriceList, parent)
                    miscrs = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                    miscrs.DoQuery(sql)
                    'Then check to make sure it was successful
                    sql = String.Format("select pricelist from oitt where code = '{0}'", BOM.TreeCode)
                    miscrs = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                    miscrs.DoQuery(sql)
                    If miscrs.Fields.Item("pricelist").Value <> MCLPriceList Then
                        logfile.WriteLogRecord("BOM header pricelist change failed for bom " & BOM.TreeCode & ": " & vbCrLf & vbTab & mReturnStatus.ToString)
                    Else
                        'update the price list price for the parent bom (if it's a make part).
                        oItm = oCompany.GetBusinessObject(BoObjectTypes.oItems)
                        If oItm.GetByKey(parent) Then
                            If oItm.ProcurementMethod = BoProcurementMethod.bom_Make Then
                                If Not IsNothing(oItm.PriceList) Then
                                    Try 'pgm is failing sometimes on " if oitm.pricelist.price = mclpricelist with object reference not pointing to instance of an object for some reason
                                        For a As Integer = 0 To oItm.PriceList.Count - 1
                                            oItm.PriceList.SetCurrentLine(a)
                                            If oItm.PriceList.PriceList = MCLPriceList Then
                                                oItm.PriceList.Price = TotalPrice
                                                oItm.PriceList.Currency = "$"
                                                Exit For
                                            End If
                                        Next
                                    Catch ex As Exception
                                        pricelistfail = True
                                        logfile.WriteLogRecord(mReturnStatus.ToString)
                                    End Try
                                    If Not pricelistfail Then
                                        retval = oItm.Update
                                        If retval <> 0 Then
                                            logfile.WriteLogRecord(mReturnStatus.RtnMessage)
                                        End If
                                    End If
                                Else
                                    mReturnStatus.RtnMessage = -99
                                    mReturnStatus.RtnMessage = ("Price List object is corrupt for item " & oItm.ItemCode & "(Object reference not set to an instance of an object)")
                                End If
                            End If
                        End If
                    End If
                End If
            Catch ex As Exception
                logfile.WriteLogRecord(mReturnStatus.ToString)
            Finally
                If Not IsNothing(rs) Then
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rs)
                    rs = Nothing
                End If
                If Not IsNothing(miscrs) Then
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(miscrs)
                    miscrs = Nothing
                End If
                If Not IsNothing(oItm) Then
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oItm)
                    oItm = Nothing
                End If
                GC.Collect()
            End Try
        End Sub
    I have also gotten some strange errors in this program after it has been running for hours.  I've been assuming that they've been caused by low memory, but I actually got a system.nullreferenceexception on this line:
                                            If oItm.PriceList.PriceList = MCLPriceList Then
    And also, this message:                       '[Microsoft][SQL Native Client]Connection is busy with results for another command'
    on this line (near the top of the sub):      rs.DoQuery(sql)
    but it only occurs after it's been running for several hours.  You'll note 'rs' is a local variable and it's used in a loop.  I don't instantiate it each time in the loop.
    Big problem, long message & I appreciate you taking a look.

  • Real Memory vs CPU usage?

    I have a few questions:
    - Should I look at CPU or Real Memory to find out which applications are eating a lot of power?
    - Moreover, looking @ my activity monitor, I noticed Firefox and iTunes and Mail eating up much memory, is this normal or is this a Lion issues.
    - What is " Kernel task " as conveyed in the image.. It is using up almost 1GB of ram!
         - Moreover, am barely running anything huge, like AutuCad, and yet I have used 4.75GB of ram?

    Kernel Task is the OS - kill that and you won't be able to run anything
    You're not using more than half the 8gb you have so don't worry about it.
    Change Activity Monitor to show My Processes to see the sort of things you can safely play with.
    Regards,
    Colin R.
    PS Mine looks like this:

  • Mail.app and huge memory leak

    Mail.app have some serious memleaks: http://jabster.nazwa.pl/MailAppMemLeak.mov (recorded from activity monitor). Mail.app can eat all memory and cause system to become unrespondable. Anyone have similar issue?

    Solved it!
    I have several email accounts configured in Mail. While Mail was eating up the memory, I've noticed the rotating circle at one of the accounts indicating Mail is doing something with it. This particular account was Google mail via IMAP. What I did to resolve problem is I deleted Google mail from my accounts and I've restarted Mail. Things turned back to normal! Then I've added GMail account again, and it is working like a charm since, Mail is using only 238Mb of memory.
    Therefore, I can conclude there is a bug in Mail handling email accounts (in my case Google mail via IMAP) and it is doing something with that account that increasingly takes ridiculous amounts of memory. Removing the account in questions, restarting Mail and adding the account again has solved the problem in my case :))
    Danny

Maybe you are looking for

  • N95 camera problem v21.0.016

    Need help!!! After updating my N95 into v21.0.016, the quality of the camera degraded... I don't know if its the flash.... the flash still flashes but seems that it doesn't have any effect in the image.... TO explain further, I'll give an example: Be

  • I updated to 10.6.8 and my internal camera isn't working

    I need help getting my camera working i've went into facetime/photo booth and it reads no camera connected i've also tryed to to login as a dfferent user it still reads no camera ive also went into system profiler and it does not come up

  • How to open glassfish log file?

    I go to Program File/glassfish/domains/domain1/ but I not found anything. It's empty folder. How to open glassfish log file . please help me.

  • LabVIEW coding using wnaspi32.dll

    Hi to all, here I need you guys help in LV coding with wnaspi32.dll for I have no experience in doing that at all! I will appreciate if any of you can tell me what the equivalent in lv code for 1) typedef struct BYTE SRB_Cmd; // ASPI command code = S

  • BOR object

    Hi, I have added a method to an existing BOR object but I made its release status to obsolete accidentally. Now I want to make some changes to the method added. I may have to delete it as per our requirements. Please suggest. Its too urgent. One more