Memory Leak in BI SDK with XMLA Connector ?

Hi,
I am using BI SDK 3.5 with XMLA Connector. I noticed that in com.sap.ip.bi.sdk.dac.connector.xmla.impl.Connection class, the LocalTransaction object is rollbacked when the close() method is called.
This makes a call to the endTransaction() method of Repository class with "true" parameter and leads to informations storage into a RepositoryDBMemory instance.
The only way I found to avoid this is to call the endTransaction() method with "false" as parameter, which is what is done in commit() method of the LocalTransaction class.
So, I tried to commit the transaction before closing the connection but in XMLA mode, the getLocalTransaction() method throws an BIResourceException so it is impossible to commit it. This is the first issue.
Second issue: it seems that data hold by the DataSetContentHandler is not freed. I tried using SAP Parser, Xerces, Java Parser but it has no effect. I hava a MDX query that returns 13000 lines, the XML file size is about 15Mo.
In a for loop with 10 operations, it leads to a OutOfMemory error quickly (only 7 iterations OK with -Xmx256m -Xms256m options). On each iteration, the memory grows about 25 to 30Mo !
For the first point, I do not call the close method on the connection object and it is garbage collected (but, in my opinion, it is quite strange not calling the close() method on a connection object).
For the second one (DataSetContentHandler), I have no idea. Has someone already encounter this problem ? The Netbeans profiler tells me it is this object that holds all java.lang.String objects. Is it right ?
I saw in DataSetContentHandler class that it has two static fields: one for the row cursor of the dataset, the other one for column cursor. Why ? Is it OK in a multi-threaded context ?
<b>This is urgent as we will not put the project in production mode with such a memory leak ! We must find the problem very quickly.</b>
Thanks in advance for any help you might give to me !
Regards,
David Degardin (Ubik-Ingenierie)

I found the same thing. Tracing the execution back I found the only place this function was called was as part of the setup, so you shouldn't have to worry about it getting called multiple times and leaking memory. The trouble seems to be when the AudioPlayer dealloc method is called, the memory is not cleaned up.
My fix was to modify the dealloc in AudioQueueObject to check to see if audioLevels is nil and, if not, free it. This seems to have fixed the problem.

Similar Messages

  • Memory leak: critical (blocker) bug with unloading SWF with Vector. T

    Here's the original bugreport https://bugbase.adobe.com/index.cfm?event=bug&id=3071138
    dated december 2011 (add actually appeared even earlier). Despaired of getting any Adobe's team attention I even submitted it again today (as of new releases of FP 11.3 and AIR 3.3 betas).
    Chris Campbell, seems like u're active on this forums. Can you give any feedback?

    This bug has definitely been around a while.  The good news is that it's currently slated "Open / To Fix" for our AIR 3.3 release which is currently up on labs.adobe.com  (our internal number is 3072792).  We've been able to reproduce the problem and our development team is actively investigating.
    The best way to make sure this gets continued focus is to recommend to everyone you know who is affected by this bug to take a minute and cast their vote on the public bug.
    Bug 3071138 - Cannot unload (Loader.unloadAndStop) SWF with Vector.<T>

  • Memory leaks in NSURLConnection when using with ssl.

    Hi,
    I am experiencing a memory leak while using nsurlconnection with https request.
    I have a web-service over http and as well as HTTPS. When i call the web-service with HTTP i don't get any memory leak while when I call the web-service over HTTPS i got memory leaks, responsible library for this memory leak is cfnnetwork and responsible caller is nsurlrequest::setsslrequest.
    I just wanna make sure that should we have to set any property in nsurl for HTTPS request..
    I will be really helpful If someone can help me out.
    thanks in advance.

    I get the same(Or similar) issue... 48 Bytes for every call is being leaked. Instruments says that it's NSURLConnection that's leaking an NSString somewhere... Blowed if I can find why, build and analyse doesn't complain about that piece of code (Except that I'm releasing the url request late... i.e. by the caller instead of the method that allocates it. Naughty I know, but autorelease'ing the object had the same problem).
    This is on the simulator BTW...
    H

  • Memory leak while debugging but not in release version

    I have an Adobe AIR application that must load and unload multiple external swfs, and it must run for hours.
    I had an issue where there was a memory leak. I tried all kinds of fixes, including rolling back SDKs and Adobe Runtime,
    but every time I tested in Flashbuilder, the memory would climb, and with each unload a FlexLoader would stay in memory.
    Finally I tried creating a release build, and low and behold the memory did not climb. It stayed the same even under stress testing.
    So evidently, the memory leak had to do with debug version, and once it was a release version, the leak disappeared.

    UPDATE: The problem was with the external swfs being loaded into the main application.
    If I compiled them in debug, they leaked. In release version they did not.

  • HTTPService + XML Load + Memory Leak

    Hi all....
    I have noticed a memory leak in my application. This leak was
    not apparent when the application was completed some months back
    which is what left me a little confused as all I have done since
    was upgrade to Flex 3 and possibly updated / changed my Flash
    player.
    I think I have found the cause to this problem (below) but am
    not 100% sure that it is the "actual" problem or any reasons to
    back my thoughts up, so have listed what I have checked / tried
    along the way (maybe I have missed something)....
    My Discovery Process:
    I started profiling my application but did not find anything
    out of the ordinary. I did a code walk-through double checking I
    had cleaned up after myself, removing and even nulling all items
    etc but still to now success - the leak is still there.
    I have profiled the app in the profiler for reasonably long
    periods of time.
    All the classes etc being used within the app are consistent
    in size and instance amount and there is no sign of any apparent
    leak.
    I am using a HTTPService that is loading XML data which I am
    refreshing every 5 seconds. On this 5 second data refresh some
    class instances are incremented but are restored to the expected
    amount after a GC has occurred. The GC seems to take longer, the
    longer the app is running, therefore more and more instances are
    being added to the app, but when the GC eventually runs it "seems"
    to clear these instances to the expected amount.
    After scratching my head for a while I decided to make a copy
    of my application, rip everything out, and focus in my data load,
    where I found a problem!
    I have now just a HTTPService that loads an XML file every 5
    seconds, and this is all I currently have in the app (as I ripped
    the rest of the code out), e.g:
    Code:
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    ....... creationComplete="initApp()" >
    <mx:HTTPService
    id="httpServiceResults"
    url="
    http://myIP:myPort/myRoot/myXML.cfm"
    resultFormat="e4x"
    result="httpResultHandler(event)" />
    <script....... >
    private var timerPulse:Timer;
    private function initApp():void
    httpServiceResults.send();
    timerPulse = new Timer(5000, 0);
    private function httpResultHandler(event:ResultEvent):void
    timerPulse.start();
    timerPulse.addEventListener(TimerEvent.TIMER, timerRefresh);
    public function timerRefresh(eventObj:TimerEvent):void
    timerPulse.stop();
    timerPulse.removeEventListener(TimerEvent.TIMER,
    timerRefresh);
    timerPulse.reset();
    httpServiceResults.send();
    </script>
    </mx:Application>
    This is pretty much the code I am currently using and it
    leaks.
    I ran and monitored this in both the profiler and the
    activity / task manager, and after running the app for 1800 seconds
    (30 min) in the profiler, the memory size grew from 50mg to 165mg
    just sending the HTTPService.
    I tried loading the service in multiple ways including in AS
    rather than MXML creating new instances of it each time, resetting
    it, nulling it etc... but nothing prevented this memory increase.
    I then tried to load the XML using different methods such as
    using the URLRequest and URLLoader which again caused a memory
    leak.
    What still confuses me is that this leak did not exist in the
    previous version and not a great deal has changed since then apart
    from upgrading to Flex 3 and possibly upgrading my Flash payer
    (which I believe is a possible cause)
    After looking into this issue a bit more deeply, I read a few
    blogs / forums and other people are experiencing the same problems
    - even with a lot bigger leaks in some cases all when reloading
    large sets of XML data into Flex - however, I as of yet found no
    solution to this leak - people with a similar problem believe it is
    not due to a memory leak more a GC error, and others pointing
    towards the Flash Player itself that is leaking - I don't really
    know.
    Findings so far during investigation of this issue:
    * App leaks for both HTTPService and ULRRequest / URLLoader
    methods
    * App only leaks when calling a data loader
    * The size of the leak seems to depend on the size of the
    XML being loaded
    * The size of the leak also seems to be affected by the
    applications heaviness - the greater seems to enhance the leak
    An interesting factor I have noticed is that if I copy the
    XML from my "myXML.cfm" that I link to in my HTTPService and copy
    the contents of the file into my own XML file stored within the
    Flex project root itself: ""myXML.xml"" the leak disappears... like
    it seems to link when loading the XML over a network, however as my
    network knowledge is not great I am not sure what to make of this -
    any ideas???
    Could the connection to the XML document cause leaks??? is
    there anything else that could cause this leak??? have I something
    in my code sample that could cause this leak??? or could any of the
    other things I have mentioed cause this leak???
    Any help / ideas would be greatly appreciated.
    Thanks,
    Jon.

    I also observed heavy memory leak from using httpservice with
    XML data. I am using Flex3 builder under Linux. My Flex application
    polls httpservice every 10 seconds. The reply is a short XML
    message less than 100 bytes. This simple polling will consume 30+
    MB of memory every hour. I leave it idling for several hours and it
    took 200 MB of memory. No sign of garbage collection at all.

  • T61 with memory leak on XP for driver battc.sys

    Hi
    I have an issue with XP where the battc.sys module that is part of Windows XP and responsible for the kernel side of monitoring the battery status. This module continually leaks memory until I have no more kernel paged resources left and programs start to fail on my laptop.
    I raised a support case for this with Microsoft and after some investigation and upgrading to the latest T61 power drivers that were released a few days ago on the Lenovo site, MS support told me it is a fault of the T61 and that I would need to disable Microsoft APCI support to stop this memory leak from occuring and to take the issue up with Lenovo.
    I have used the verifier tool to confirm that it is the Windows XP SP3 battc.sys memory module leaking.
    I am running the latest T61 drivers and fully patch with MS drivers on SP3.
    As MS have told me it is the fault of the T61 I am posting this issue here.
    Thanks
    Stephen

    It is memory available to the kernelwhich itself does not show under a process in task manager as far as I am aware (unles it is taken account as part of the system process).
    The best way to measure the available kernel memory space available is by using sysinternals procexp.
    You need to download procexp and also install the windows debugging tools from Microsoft. Then in procexp set the "Options > Configure Symbols : Debughlp.dll path" to the new debughlp.dll installed with your debu tools and set the symbols path to srv*c:\Symbols*http://msdl.microsoft.com/download/symbols
    Then you can choose in procexp "View > System Information" and see the used and total paged and non-paged kernel memory space.
    poolmon helps monitor all the symbols that are taking up this memory and verifier lets you drill down to the exact module and the changes in memory for a module that is occuring.
    Here are two really good links on it
    http://blogs.msdn.com/ntdebugging/archive/2006/12/18/Understanding-Pool-Consumption-and-Event-ID_3A0...
    http://blogs.msdn.com/ntdebugging/archive/2008/05/08/tracking-down-mmst-paged-pool-usage.aspx
    In my poolmon i notice that Mmst and battc are taking alot of memory after my computer has been running for some time. Mmst being high is normal but battc should not continually be growing as it is which is why I raised the case to MS but they want verification it is not a Lenovo issue.

  • How do I report a major memory leak problem with Firefox 3.6.10 in WinXP?

    After I installed Firefox 3.6.9 on a WinXP desktop, I occasionally had minor memory leak problems, reflected by getting "out of virtual memory" messages. I upgraded to 3.6.10 when notified that it was available and that it supposedly fixed stability problems. Ever since then, whenever I use Firefox, it starts out quick as a flash, but very rapidly slows down to a crawl, and has twice brought my system to a halt. IE does not cause this, nor any other program I use, but the execution speed of all programs slows as badly as Firefox. If I knew where to get older versions, I would back up to 3.6.9 or earlier. The situation now prevents me from using Firefox much at all.

    Im running windows 7, Firefox 3.6.10 and before i updated to 3.6.10 my CPU never went above 10% with Firefox open. Now it can spike well above 50% and i have nothing different from when i had 3.6.9 to now when i have 3.6.10.
    There is no evidence for me to suggest one of the additions i have is causing it, its all pointing to Firefox itself and the last update.

  • How can I address a memory leak problem with Firefox?

    I have happily used Firefox for the past 7 years, and have rarely had difficulties. However, I am having some trouble now; Firefox (running 3.6.6) seems to have a memory leak on my machine. It's slower than what was discussed in other forum posts, but it still scales up slowly to multiple hundred MBs of Memory with very little CPU usage.
    I have tried disabling add-ons and extensions, but this does not stop the problem. I have cleared my cache and other stored data, but that also does not help. Has anyone experienced a similar problem that might be able to help?
    == This happened ==
    Every time Firefox opened
    == within last two weeks

    Hi reble0708,
    I have Java console disabled on my Firefox browser.Everything is working fine for me. There maybe other problem on your browser which is making PDF document faded and blurry. Can you post the link where you found the problem viewing the PDF document?
    Btw, you can go to ftp://ftp.mozilla.org/pub/firefox/releases/ and select the previous version of Firefox from the given options. There's no need to uninstall Firefox before you downgrade to the previous version of it.But before new installation, backup your Firefox profile folder.
    edit: replaced random unofficial download site link.

  • Memory leak in Flash with Win7, IE9, 64bit

    I have been having an issue for quite some time on 2 different computers. Both of them are Windows 7 64bit and use IE9.
    Generally I have 1 - 5 tabs open in IE at any given time. Usually one of them is a tab for Yahoo Mail. Other tabs are related to whatever I may be searching for or doing at that time, so pretty varied. Throughout the day at random times I will begin to get a grey icon for anywhere on some tabs where there is supposed to be a flash video (like the ad in the right side of the Yahoo Mail tab)... When it happens I can open Task Manager in windows and I notice that 1 or two "iexplore.exe *32" processes have memory consumed in excess of 600,000K. When I end those processes I am again able to see any flash videos that need to be viewed.
    If I leave Task Manager open throughout the day I can see the memory consumption increase on various tabs until I cannot see any more flash videos or even open new tabs in IE until I end those processes. Further, the memory does not get released if I just close the tabs in IE, but I must either end the specific process or close all tabs in IE so that IE is completely unloaded.
    I have since uninstalled the Flash player and the issue has gone away. I can re-install the flash player and the issue returns. Can you please help? This has been a huge annoyance and I had hoped that it would be fixed sooner or later. Unfortunately it has not been fixed and has finally prompted me to post something....

    First, I just wanted to follow up on this thread and let you guys know that we'll continue to look into it.  I also want to clarify some player behavior, and provide tips for helping to identify a defect that we can take action on.
    Whenever you refresh/reload a tab, the browser should signal to us that our process is being destroyed, at which point we would release all of our resources and shut down.  SergeStone's comment above makes it sound like this might not be happening in a particular case.  I'm going to build out a few tests this week to explore this in more detail, and I'll follow up with results.
    Also, it's worth discussing the difference between memory consumption and memory leaks.  Flash Player is designed to consume a percentage of your available memory.  If you have a 32-bit machine with 2GB of RAM, we're going to consume a lot less memory than a 64-bit system with 16GB of RAM. 
    Not all Flash content is authored well.  If the ActionScript developer is continuously loading objects into their SWF and never releasing them (a slide-show is a good simplistic example), you'll see a steady usage increase as each new object loads in.  You should also see that evenutally, our automatic Garbage Collection process will kick in.  Memory will peak out, and then you'll see a short CPU spike as we look at all of the available objects and cull as many unused ones as possible, consumed memory will dip down significantly (as long as we can cull stuff), and then start growing again until the next time GC kicks in.  We tend to do this judiciously, as poorly-timed GC can cause games to stutter if it happens when lots of things are moving around on the display and you don't have a lot of available CPU.
    If it's our bug, it should be straightforward to fix, and I can follow up to this thread with a beta build for you guys to evaluate once we have one available.  In the meantime, it would be interesting to know if you're seeing the problem on our current Beta builds (which is where we would do the work). 
    Here's a link to the latest Beta download:
    http://labs.adobe.com/downloads/flashplayer11-5.html
    Also, the simplest example is the most actionable.  If you can find a situation where a site in a single tab reproduces the problem, that's a quick and easy thing to deal with.  If the repro case involves opening seven tabs and waiting six hours, someone needs to repeat that over and over, until they can isolate what content experiences the problem and then iterate a bunch more with a debugger attached to try and isolate the root cause.  The more complicated the content, the more difficult that is.
    Secondly, I wanted to offer some actionable suggestions that you could use now to work around this issue. 
    Try Firefox or Chrome.  Both of these browsers run Flash Player as a separate process.
    For those of you using Performance Monitor and other tools to measure, you can directly observe the resources used by Flash Player
    For the folks concerned about Bookmarks synchronization, both Firefox and Chrome provide native bookmark syncing and import from IE mechanisms. 
    Xmarks is a really nice, free utility that provides cross-browser, cross-platform bookmark synchronization.
    Thanks,
    Jeromie Clark

  • Memory Leak issue with TreeView

    Hi,
    I get Memory Leaks in the TreeView, if I open the stage which contains the TreeView several times.
    Everytime I open the stage, I clear the TreeView and populate it with new items.
    However there are leaks.
    I think this is a bug. But maybe my code is wrong and someone could comment on this issue.
    See this test case:
    i < 10: 5854 KB
    i < 100: 35944 KB
    i < 200: 64515 KB
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeView;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    public class TestApp3 extends Application {
        public static void main(String[] args) throws Exception {
            launch(args);
        public void start(final Stage stage) throws Exception {
            VBox root = new VBox();
            SubStage subStage = new SubStage();
            for (int i = 0; i < 10; i++) {
                subStage.show();
                subStage.hide();
            System.gc();
            System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        private class SubStage extends Stage {
            public SubStage() {
                TreeView<String> treeView = new TreeView<String>();
                final TreeItem<String> rootNode = new TreeItem<String>("Root");
                treeView.setRoot(rootNode);
                setOnShowing(new EventHandler<WindowEvent>() {
                    @Override
                    public void handle(WindowEvent windowEvent) {
                        rootNode.getChildren().clear();
                        rootNode.getChildren().add(new TreeItem<String>("Item"));
                Scene scene = new Scene(treeView);
                setScene(scene);
    }Edited by: csh on 07.09.2012 06:14
    Edited by: csh on 07.09.2012 06:14

    Hi. If You replace
        rootNode.getChildren().clear();
        rootNode.getChildren().add(new TreeItem<String>("Item"));
      with:
         rootNode.getChildren().setAll( new TreeItem<String>("Item"));
    You will get the following:
    i < 10: 2881 KB
    i < 100: 3341 KB
    I <200: 3478 KB

  • Memory Leak Issue With Win7 64 bit and Youtube.

    I have a Win7 64 bit using IE9 with version 11.4.402.265 installed. 4 MB installed.
    Whenever I go to Youtube or Liveleak, and watch videos, over time it uses up to 4gigs of my memory! Even if I close the window, it does not free up the memory until I Ctrl/Alt/Delete and shut down the window(s).
    I normally only keep open 1-2 windows. Google toolbar is about the only thing installed. I can open 5 and more tabs, but as long as the site does not use flash, I don't have issues and each window usually uses under 200k memory watching them in task manager.
    When I go to open and watch a youtube video, it slowly climbs to 200k and within an hour, I can be at 2 gigs or more memory and up to 4 gigs within 2 hours (or sometimes much sooner). Closing the window does not release the memory until I end task on it and then after a minute or so, the memory seems to clear and everything is back to normal.
    I searched the forums and seems lots of users, report memory leaks, some using yahoo toolbar installed, which is not my case. I do use yahoo as my e-mail address, no idea if that is related or not. I had the same issue when I had the prior Flash version installed, this has been going on for months. Right now having only this window open, using 129, 192 memory. If I open one more window (using the 64 or 32 bit browser) and start youtube, the memory in that window keeps climbing about 50-100kb a second, so it adds up quickly. I have kaspersky running in the background and that is about it other then my nvida driver setup.
    Really frustrating that so many people here and across the internet have reported this. I did have IE8 a few weeks ago and still had the same issue, upgraded to IE9 to see if that helped.
    Interesting side note, if I pause a video, it slows way down on the memory leak, but still rises at a slower pace. I don't know if this is an IE thing or Flash. I have had this setup since 2009 and don't recall having issues with IE7. I use Youtube so much as a teaching instrument as a music teacher, so constantly have lessons going on it.
    Thanks and hope someone has come up with something. I also build computers and have done some programming, so I could modify a file if needed with clear instructions.

    This could be similar to bug https://bugbase.adobe.com/index.cfm?event=bug&id=3334814

  • Memory leak issue with link server between SQL Server 2012 and Oracle

    Hi,
    We are trying to use the linked server feature with SQL Server 2012 to connect SQL server and Oracle database. We are concerned about the existing memory leak issue.  For more context please refer to the link.
    http://blogs.msdn.com/b/psssql/archive/2009/09/22/if-you-use-linked-server-queries-you-need-to-read-this.aspx
    The above link talks about the issues with SQL Server versions 2005 and 2008, not sure if this is still the case in 2012.  I could not find any article that talks about if this issue was fixed by Microsoft in later version.
    We know that SQL Server process crashes because of the third-party linked server provider which is loaded inside SQL Server process. If the third-party linked server provider is enabled together with the
    Allow inprocess option, the SQL Server process crashes when this third-party linked server experiences internal problems.
    We wanted to know if this fixed in SQL Server 2012 ?

    So your question is more of a information type or are you really facing OOM issue.
    There can be two things for OOM
    1. There is bug in SQL Server which is causing the issue which might be fixed in 2012
    2. The Linked server provider used to connect to Oracle is not upto date and some patch is missing or more recent version is to be used.  Did you made sure that you are using latest version.
    What is Oracle version you are trying to connect(9i,10g, R2...)
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Memory Leak with new Font()

    Hello all,
    Not sure if this is the right place to post this but here goes. I have a program that needs to change the font of at least 250,000 letters, however after doing this the program runs slow and laggy as if changing the fonts of each letter took up memory and never released it? Here is a compilable example, Click the button at the bottom of the window and watch the letter it is currently working on. You will notice that around 200,000 it will begin to not smoothly count up anymore but count in kind of a skipping pattern. This seems to get worse the more you do it and seems to indicate to me that something is using memory and not releasing it. I'm not sure why replacing a letter's font with a new font would cause more memory to be taken up I would think if I was doing it properly it would simply replace the old font with the new one not taking anymore memory then it did before. Here is the example: This program sometimes locks up so be prepared. If someone could maybe point out what is causing this to take up more memory after changing the fonts that would be great and hopefully find a solution :) Thanks in advance.
    -neptune692
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package paintsurface;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.util.List;
    public class PaintSurface implements Runnable, ActionListener {
    public static void main(String[] args) {
            SwingUtilities.invokeLater(new PaintSurface());
    List<StringState> states = new ArrayList<StringState>();
    Tableaux tableaux;
    Random random = new Random();
    Font font = new Font("Arial",Font.PLAIN,15);
    //        Point mouselocation = new Point(0,0);
    static final int WIDTH = 1000;
    static final int HEIGHT = 1000;
    JFrame frame = new JFrame();
    JButton add;
    public void run() {
            tableaux = new Tableaux();
            for (int i=250000; --i>=0;)
                    addRandom();
            frame.add(tableaux, BorderLayout.CENTER);
            add = new JButton("Change Font of letters - memory leak?");
            add.addActionListener(this);
            frame.add(add, BorderLayout.SOUTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(WIDTH, HEIGHT);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    public void actionPerformed(ActionEvent e) {
        new Thread(new ChangeFonts()).start();
    void addRandom() {
            tableaux.add(
                            Character.toString((char)('a'+random.nextInt(26))),
                            UIManager.getFont("Button.font"),
                            random.nextInt(WIDTH), random.nextInt(HEIGHT));
    //THIS CLASS SEEMS TO HAVE SOME KIND OF MEMORY LEAK I'M NOT SURE?
    class ChangeFonts implements Runnable {
        public void run() {
        Random rand = new Random();
            for(int i = 0; i<states.size(); i++) {
                font = new Font("Arial",Font.PLAIN,rand.nextInt(50));
                states.get(i).font = font;
                add.setText("Working on letter - "+i);
    class StringState extends Rectangle {
            StringState(String str, Font font, int x, int y, int w, int h) {
                    super(x, y, w, h);
                    string = str;
                    this.font = font;
            String string;
            Font font;
    class Tableaux extends JComponent {
            Tableaux() {
                    this.enableEvents(MouseEvent.MOUSE_MOTION_EVENT_MASK);
                    lagState = createState("Lag", new Font("Arial",Font.BOLD,20), 0, 0);
            protected void processMouseMotionEvent(MouseEvent e) {
                    repaint(lagState);
                    lagState.setLocation(e.getX(), e.getY());
                    repaint(lagState);
                    super.processMouseMotionEvent(e);
            StringState lagState;
            StringState createState(String str, Font font, int x, int y) {
                FontMetrics metrics = getFontMetrics(font);
                int w = metrics.stringWidth(str);
                int h = metrics.getHeight();
                return new StringState(str, font, x, y-metrics.getAscent(), w, h);
            public void add(String str, Font font, int x, int y) {
                    StringState state = createState(str, font, x, y);
                    states.add(state);
                    repaint(state);
            protected void paintComponent(Graphics g) {
                    Rectangle clip = g.getClipBounds();
                    FontMetrics metrics = g.getFontMetrics();
                    for (StringState state : states) {
                            if (state.intersects(clip)) {
                                    if (!state.font.equals(g.getFont())) {
                                            g.setFont(state.font);
                                            metrics = g.getFontMetrics();
                                    g.drawString(state.string, state.x, state.y+metrics.getAscent());
                    if (lagState.intersects(clip)) {
                    g.setColor(Color.red);
                    if (!lagState.font.equals(g.getFont())) {
                        g.setFont(lagState.font);
                        metrics = g.getFontMetrics();
                    g.drawString("Lag", lagState.x, lagState.y+metrics.getAscent());
    }Here is the block of code that I think is causing the problem:
    //THIS CLASS SEEMS TO HAVE SOME KIND OF MEMORY LEAK I'M NOT SURE?
    class ChangeFonts implements Runnable {
        public void run() {
        Random rand = new Random();
            for(int i = 0; i<states.size(); i++) {
                font = new Font("Arial",Font.PLAIN,rand.nextInt(50));
                states.get(i).font = font; // this line seems to cause the problem?
                add.setText("Working on letter - "+i);
    }

    neptune692 wrote:
    jverd wrote:
    You're creating a quarter million distinct Font objects, and obviously you must be hanging on to all of them because each character is having its font set to the newly created object. So if you have 250k chars, you're forcing it to have 250k Font objects.
    Since the only difference is that rand.nextInt(50) parameter, just pre-create 50 Font objects with 0..49, stick 'em in the corresponding elements in an array, and use rand.nextInt to select the Font object to use.That does make sense but it does that when the the program is first launched and doesn't lag. But the second and third time you change the letters font it seems to lag so if it wasn't taking up more memory the second time it should perform like it did when it first launched. I don't care to investigate any further. The real problem is almost certainly the quarter million Font objects. It could be that 250k is fine, but by the time you get to 500k, it has to do a lot of GC, and that's where the slow down is coming. You might even be able to make it work better with the code you have just by tweaking the GC parameters at startup, but I wouldn't bother. Fix the code first, and then see if you have issues.
    Does creating a new font for each of those letters not replace the old font object? If it didn't use more memory the second and third time I don't think you would see the skipping in the counter and the slowing down of the iterations. So it must be remembering some of the old font objects or am I wrong?Using new always creates a new object. When you do it the second time around, and call letter.setFont(newFont), the old Font object is eligible for GC. That doesn't mean it will be GCed right away though. The JVM can leave them all laying around until it runs out of memory, and then GC some or all of them.

  • Memory leak in AudioServicesCreateSystemSoundID with sound files

    hi !
    Instruments indicates a 64Ko memory leak in "AudioServicesCreateSystemSoundID" when I use a sound that I have created with GBand / iTunes. When I use the sound file "tap.aif" from the "sysSound" sample, there is no memory leak.
    What's wrong with my audio file ?
    It's a AIFF file, 95Ko, 8 bit mono 22Khz @ 176kbps.
    thanks...

    appFile = [ [ NSBundle mainBundle ] pathForResource : _filename ofType : _extension ];
    FileUrl = [ NSURL fileURLWithPath: appFile ];
    if ( AudioServicesCreateSystemSoundID( ( CFURLRef ) FileUrl, &soundID ) != kAudioServicesNoError )
    return false;
    I don't think the code is wrong because when I change the name of the sound in '_filename', there is no leak.
    I haven't found in the documentation the audio file properties ( 8/16 bits, ... ) supported by 'AudioServicesCreateSystemSoundID'.
    The code is for iPhone.

  • Memory leaks with Third party classes

    Hello all,
    This is fairly known problem. But I guess, my problem gives a new dimention to the problem.
    I have an application which is developed by me. This application ideally needed to use third party classes ( obviously no source code is supplied ). These third party classes provide extra functionality required.
    The problem is, when I don't use third party classes in my application, every thing is fine. When I include third party classes, I am having memory leaks.
    Then I tried to investigate memory leaks with Optimizeit tool. It is new to me. As of now, I understood, we can identify where the memory leaks are occuring.
    finally the problem is, in order to solve this, I need some patches in the code. But I don't have source code for those classes. How to solve this problem?
    For example,
    I use a third party classes in my code like this,
    ThirdPartyMemoryLeakClass obj = new ThirdPartyMemoryLeakClass();
    This 'obj' is made static, as it takes lot of time to create this object. Obviously this object contains several references to other objects, which I can't control.
    In the process of reusing this object, I am getting memory leaks.
    Any ideas regarding, how one has to deal this type of situations? What are the issues involved with this case? Are there any similar problems, which have been solved? are most welcome.
    many thanks for your time.
    Madhav

    Decompile it using jad. Find leak.Yes, I too got the idea and tried to decompile those classes and recompile. I had some problems while recompiling. Is this is the only way to get rid of this problem?
    I was refering to powersoft.datawindow.DataStore class. Does any body here has worked on these?
    Can you suggest me how to find the memory leak causes? if you were needed to find out memory leak causes, what would be your approach?
    Madhav

Maybe you are looking for

  • Transfer files from OS 8.6 to OS 10.5 and printer issue

    I am relatively new to the MacOS world, but I am enjoying every minute of it. I recently acquired a new iMac with OS X (10.5) on it. I also have an older Mac that runs OS 8.6 that someone just gave to me. I would love to network the two and share fil

  • The titles are not saved when i quit

    After quiting FCPX the titles i have made are not saved for next time i open a project. Some titles are saved sometime?

  • Stop Captivate from Resaving mp3 to wav

    How do I stop this? This is a huge flaw on the part of captivate. When I import an audio mp3 clip on a feedback caption it 90% of the time saves as a wav file and quadruples the size! Wav Audio is very large and makes my projects much larger than the

  • New tab ?conflicts' in Integration Repository ...

    Hi. I have made some transports between DEV box and PRD box. It seems that everything has gone fine but i have a new tab called 'Conflicts'. This tab is filled with the RFC's i've transported. How did i have to proceed with this tab? Regards. Inigo.

  • Keeps corrupting

    I created site with iWeb. Now iWeb won't launch. I followed some of the suggestions here to deal with it, but eventually just deleted the domain file altogether. What am I doing that causes this to corrupt every time. I'm using tiff images. I had thi