3d picture texture memory leak?

I'm further investigating using the 3D picture controla nd have found out a couple of really cool things.
1. Object instantiation : You can add lots of copies of objects to a scene which allows them to share much data (The "Drawable" item is shared) but allows applying individual scaling, transformation, texturing and so on.  This saves a HUGE amount of memory when instantiating lots of objects.
2. Viewports: You can define several different viewports for a 3D picture which allows limiting the display of an object to a certain portion of the 3D picture.
3. "WindowtoObjectCoords" allows for an easy method to "pin" an object at a specific point on the 3D picture display.  Coupled with a Viewport, we can implement a nice rotating 3D coordinate display which doesn't pan or scale with the rest of the picture.
I then got greedy.  I wanted to start instantiating several thousand primitives, but applying a different texture to each to give a multicoloured effect.  This works fine but whenever I run the program, I get a memory leak and I can't figure out how to get rid of this.  Following image has 8192 instances of a single box with different textures, rotations and translations applied to each.
If anyone could have a look to see what I'm actually doing wrong, that would be greatly appreciated.  The solar system example doesn't seem to suffer from this problem, but it doesn't use multiple instantiation of objects.....
I've had this problem before.  I feel it's related to texturing but I'm not sure.  Maybe the memory leak is only noticeable when texturing is used due to the much larger memory footprint.
Shane.
Say hello to my little friend.
RFC 2323 FHE-Compliant
Attachments:
3D texture memory leak.zip ‏66 KB

Ok, last post, I promise.
When freeing up memory used for a 3D picture like this, using a recursive method needs to take care to obtain a reference to each object's "Drawable" and "Texture" before removing the texture and ultimately destroying the object.  Then the Drawable and the Texture need to be destroyed also (close Reference).  Done properly it seems to be do-able.  This is because the "Drawable" and "Texture" are pointers to other data structures which are not freed up by destroying the object using them.  They need to be destroyed individually.
So I think I have a working version.  I can instantiate over 65000 objects, each with their own texture, rotation and translation and I can release them after execution with a "wobble" in the LabVIEW.exe idle memory of about 2MB.  That is to say, it increases the first few times and then stays pretty much stable.  The memory usage goes up more than 200MB when running.
Shane.
Say hello to my little friend.
RFC 2323 FHE-Compliant

Similar Messages

  • Memory Leak with Picture Control

    Hi all
    There is bug with Picture Control
    When you insert you picture data in loop into the shift register, memory leak
    Can somebody to prevent this bug?
    Run attached example and look at Task Manager
    Attachments:
    Picture Memory Leak Example.vi ‏24 KB

    I believe David properly called the cause of this memory consumption.
    In reply # 52 of thsi thread,
    http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=5&jump=true
    I posted an example that inserts 130 FP object images in a picture and moves them around (it is a random walk where each object is assigned a letter and the program terminates when all of the letters required to spell out "Hello World" wander into the trap at the bottom.)
    A snippet of the code follows.
    A) Start with a blank picture
    B) Inster all of the images
    C) show the updated image.
    Other links to LV Picture control examples can be found in this thread.
    http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14&jump=true
    Ben
    Message Edited by Ben on 01-14-2007 08:58 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Many_Objects.JPG ‏24 KB

  • Memory leak in Tomcat 5.5

    Hi all, i am experiencing memory leaks while using tomcat 5.5 and mysql connector 3.1.7.. While running the attached code tomcat swallows up to 20 mb and doesnt return it. I close down everything but the app still leaks mem. For now it's not an issue (Tomcat stays below 60mb mem of 1gb), however running this app on serveral clients will dramatically increase the memory allocation.
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.awt.Image;
    import java.awt.Graphics2D;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import javax.swing.ImageIcon;
    import com.sun.image.codec.jpeg.JPEGCodec;
    import com.sun.image.codec.jpeg.JPEGImageEncoder;
    public class Thumbs extends HttpServlet {
      private String dbDriver = "com.mysql.jdbc.Driver";
      private String dbURL = "jdbc:mysql://localhost/webapp?";
      private String userID = "javauser";
      private String passwd = "javadude";
      private Connection dbConnection;
      //Initialize global variables
      public void init() throws ServletException {
      //Process the HTTP Get request
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try{
           String maxDim = "";
           String siteString = request.getParameterValues("s")[0];
           if (request.getParameterValues("d") != null){
               maxDim = request.getParameterValues("d")[0];
           if (maxDim == ""){
               response.setContentType("image/jpeg");
               OutputStream out = response.getOutputStream();
               writePicture(out,siteString);
           else{
               if (siteString != null) {
                   int maxDimension = Integer.parseInt(maxDim);
                   response.setContentType("image/jpeg");
                   OutputStream out = response.getOutputStream();
                   writeThumbnailPicture(out, siteString, maxDimension);
        } catch (Exception ex){
            ex.printStackTrace();
            log(ex.getMessage());
      public void writePicture(OutputStream out, String siteID){
          try{
              Class.forName(dbDriver);
              dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
              PreparedStatement stmt = dbConnection.prepareStatement("select * from webcatalog where ID = ?");
              stmt.setString(1,siteID);
              stmt.executeQuery();
              ResultSet rs = stmt.getResultSet();
              if (rs.next()) {
                  byte[] data = rs.getBytes("Picture");
                  if (data != null) {
                      Image inImage = new ImageIcon(data).getImage();
                      BufferedImage outImage = new BufferedImage(inImage.getWidth(null),
                                                                 inImage.getHeight(null),
                                                                 BufferedImage.TYPE_INT_RGB);
                      // Paint image.
                      Graphics2D g2d = outImage.createGraphics();
                      g2d.drawImage(inImage,null,null);
                      // JPEG-encode the image
                      JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                      encoder.encode(outImage);
                      out.close();
              rs.close();
              stmt.close();
              dbConnection.close();
          }catch(Exception ex){
              ex.printStackTrace();
      public void writeThumbnailPicture(OutputStream out,String siteID,int maxDimension){
        try{
          Class.forName(dbDriver);
          dbConnection = DriverManager.getConnection(dbURL, userID, passwd);
          PreparedStatement stmt = dbConnection.prepareStatement("select * from webcatalog where ID = ?");
          stmt.setString(1,siteID);
          stmt.executeQuery();
          ResultSet rs = stmt.getResultSet();
          if (rs.next()) {
            byte[] data = rs.getBytes("Picture");
            if (data != null) {
              Image inImage = new ImageIcon(data).getImage();
              // Determine the scale.
               double scale = (double)maxDimension / (double)inImage.getHeight(null);
               if (inImage.getWidth(null) > inImage.getHeight(null)) {
                   scale = (double)maxDimension /(double)inImage.getWidth(null);
               // Determine size of new image.
               // One of them should equal maxDim.
               int scaledW = (int)(scale*inImage.getWidth(null));
               int scaledH = (int)(scale*inImage.getHeight(null));
               // Create an image buffer in
               //which to paint on.
               BufferedImage outImage = new BufferedImage(scaledW, scaledH,
                   BufferedImage.TYPE_INT_RGB);
               // Set the scale.
               AffineTransform tx = new AffineTransform();
               // If the image is smaller than
               // the desired image size,
               // don't bother scaling.
               if (scale < 1.0d) {
                   tx.scale(scale, scale);
               // Paint image.
               Graphics2D g2d = outImage.createGraphics();
               g2d.drawImage(inImage, tx, null);
               g2d.dispose();
               // JPEG-encode the image
               JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
               encoder.encode(outImage);
               out.close();
          rs.close();
          stmt.close();
          dbConnection.close();
        catch(Exception ex){
          ex.printStackTrace();
      //Clean up resources
      public void destroy() {
      private void jbInit() throws Exception {
    }

    you can try this:
    open your connection outside the function, and then pass it like as a parameter...
    writePicture(OutputStream out, String siteID, Connection conn)
    this can solve the problem because opening the connection inside the function spends a lot of memory...
    Hope this can help you
    Regards
    Fernando

  • Memory leak on SunOne Web Server 6.1 on application reload

    Hi!
    I am pretty sure that i have found a memory management problem in
    SunOne Web Server 6.1 .
    It started with an OutOfMemory error we got under heavy load . After
    some profiling with Jprofiler i didn't find any memory leaks in the
    application.Even under heavy load (generated by myself) i can't find
    anything ,more, i can't reproduce the error! The memory usage is
    about 20Mb and does not go up .
    However it is pretty simple to see the following behavior:
    [1] Restart the server (to have a clear picture) and wait a little for
    memory usage to stabilize.
    [2] In the application dir. touch .reload or one of the classes:
    The memory usage goes up by another 50Mb (huge amount of mem. taking
    into account the fact that it used only 20Mb under any load befor).
    Do this another time and another 20Mb gone etc..
    The JProfiler marks the memory used by classes . And it can be
    clearly seen the GC can't release most of it.
    I AM sure this is not the application that takes all the memory.
    Another hint : after making the server to reload application i can see
    that the number of threads ON EVERY RELOAD is going up by ~10-20
    threads .The # of threads goes lower over time but not the mem usage.
    My system:
    Sparc Solaris 9 ,Java 1.4.2_04-b05, Sun ONE Web Server 6.1SP5
    Evgeny

    my guess is that - because of '.reload' , web container tries to
    recompile all the classes that you use within your web application and
    hence the memory growth is spiking up.What do you mean by "tries to recompile"?The classes in
    Web-inf are already compiled! And i have only ~5 jsp's .
    (the most part of the applic. is a complicated business logic)
    If you are talking about reloading them ,yes,that's the purpose of .reload,
    isn't it? :).But it seems that container uses the memory for it's own
    classes: the usage of memory for my classes don't really grow
    that much (if at all) after reload (according to profiler)
    Also the real problem is that the memory usage grows to much for
    too long (neither seen it going down) and thus ends with OutOfMemory.
    if you are seeing the memory growth to be flat in stress environment,
    then I am not sure that why do you think that there is a memory leak ?There is no memory leak in stress environment.
    There is memory leak while reloading the application.
    It is a memory hog for sure (~20-30Mb for every reload).
    Memory leak?It seems that way because i can't see memory usage go
    down and after a lot of reloads OutOfMemory is thrown.
    also, what is jvm heap that you use ? did you try jvm tune options like -
    XX:+AggressiveHeap ?256Mb.I can set it bigger ,but how do i know that it will not just delay
    the problem ?
    Thanks for response.
    Evgeny

  • Memory Leak in latest Safari (5.0.4)?

    Since I updated to the latest Mac OS/X update Safari's memory usage seems to be increasing in a way that looks like a memory leak. I usually leave my mac running all of the time and find that after a few days Safari is using over a 1GB of real memory and 3-5GB of virtual memory. Sometimes it also seems to freeze — with the disk churning in the background when I try to switch to it.
    It may be related to viewing high-resolution images (it seems to happen more often if I view very high-resolution pictures, for example Nasa Picture of the Day).
    Anyone else seeing these issues? Occasionally it crashes when I try to kill it — I'll post the dump info next time.

    Hi,
    Delete the Safari cache and history more often, not to mention restarting your Mac.
    Disable plug-ins in Safari / Preferences - Security. See if that helps.
    Check Safari / Preferences - Extensions.
    Occasionally it crashes
    Post a crash log so we can try and help if emptying the cache and history trail / plugins / Extensions aren't the issue.
    If Safari has just crashed, press the Report button on the CrashReporter dialog box to view the crash information.
    Now copy/paste the entire contents of the Crash Reporter window into your reply here. If the crash report dialog does not appear or the crash is hard to reproduce, crash logs can be retrieved from the ~/Library/Logs/CrashReporter> folder.
    Carolyn
    Message was edited by: Carolyn

  • Memory leak in image rings on Linux

    Hello all,
    I have a very serious problem I didn't have in previous version of my soft and one of the only addition I've made recently is to use image rings. The soft uses 6Mb more every minute. If I remove the rings, it stops. It could be a wrong lead, so I'm trying to write a test case, but is there a list of identified memory leaks somewhere ?
    THanks.
    Solved!
    Go to Solution.

    OK guys, there's a very serious leak on Linux, confirmed by the code below. Every time you change the value of a picture ring, either by clicking on the arrow of the picture ring or right-click on it (callback to SetCtrlVal), it uses 1 extra Mb of mem for a 512x512 pixel image !!!
    Here's a sample code:
    // Right-click the ring to cause memory leak
    #include <stdio.h>
    #include <stdlib.h>
    #include <cvirte.h>
    #include <userint.h>
    #define RND_COLOR (((rand()<<16) ^ (rand()<<8) ^ rand()) & 0xFFFFFF)
    // (int)((double)(0xFFFFFF)*rand()/RAND_MAX)
    static int Pnl=0,
    Text, Ring, // Controls
    NbVals=16, // Number of images in the ring
    Width=512, Height=512; // Of the Canvas and image ring
    // Returns memory used by process in 4Kb page:
    // TotalSize Resident Share Text Lib Data Dirty
    // See "man proc" section statm
    static char* ReadOffMemoryStatus(void) {
    static char statm[80];
    statm[0]='\0';
    #ifdef _NI_linux_
    FILE *f = fopen("/proc/self/statm","r");
    if (f)
    fgets (statm, 79, f),
    fclose(f);
    #endif
    return statm;
    static void Prepare(const int Nb) {
    Point polyPoints[10]={{0,0}};
    char Str[10];
    int i, Bitmap;
    int Canvas=NewCtrl(Pnl, CTRL_CANVAS, "", 0, 0);
    SetCtrlAttribute(Pnl, Canvas, ATTR_DRAW_POLICY, VAL_UPDATE_IMMEDIATELY);
    SetCtrlAttribute(Pnl, Canvas, ATTR_WIDTH, Width);
    SetCtrlAttribute(Pnl, Canvas, ATTR_HEIGHT, Height);
    // SetCtrlAttribute(Pnl, Canvas, ATTR_ENABLE_ANTI_ALIASING, 1); // No compile on Linux
    SetCtrlAttribute(Pnl, Canvas, ATTR_PICT_BGCOLOR, RND_COLOR /*VAL_TRANSPARENT*/);
    SetCtrlAttribute(Pnl, Canvas, ATTR_PEN_FILL_COLOR, RND_COLOR);
    SetCtrlAttribute(Pnl, Canvas, ATTR_PEN_COLOR, RND_COLOR);
    SetCtrlAttribute(Pnl, Canvas, ATTR_PEN_WIDTH, 7);
    for (i=0; i<10; i++)
    polyPoints[i].x=(Width*rand()/RAND_MAX),
    polyPoints[i].y=(Height*rand()/RAND_MAX);
    sprintf(Str, "%d", Nb);
    // CanvasStartBatchDraw(Pnl, Canvas);
    // This sometimes doesn't work on Linux
    CanvasDrawPoly (Pnl, Canvas, 10, polyPoints, 1, VAL_DRAW_FRAME_AND_INTERIOR);
    CanvasDrawLine (Pnl, Canvas, MakePoint(Width-1,0), MakePoint(0, Height-1));
    SetCtrlAttribute(Pnl, Canvas, ATTR_PEN_COLOR, VAL_BLACK);
    SetCtrlAttribute(Pnl, Canvas, ATTR_PEN_FILL_COLOR, VAL_WHITE);
    CanvasDrawText(Pnl, Canvas, Str, VAL_APP_META_FONT,
    MakeRect (2, 2, VAL_KEEP_SAME_SIZE, VAL_KEEP_SAME_SIZE), VAL_UPPER_LEFT);
    // CanvasEndBatchDraw(Pnl, Canvas);
    GetCtrlBitmap(Pnl, Canvas, 0, &Bitmap);
    DiscardCtrl (Pnl, Canvas);
    InsertListItem(Pnl, Ring, Nb, NULL, Nb); // The value is the color, so remember which one you use
    SetCtrlBitmap (Pnl, Ring, Nb, Bitmap);
    DiscardBitmap (Bitmap);
    int CVICALLBACK cb_Change(int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2) {
    static int i=0;
    switch (event) {
    case EVENT_RIGHT_CLICK:
    case EVENT_RIGHT_DOUBLE_CLICK:
    SetCtrlVal(Pnl, Ring, i=(i+1)%NbVals);
    // No break;
    case EVENT_COMMIT:
    SetCtrlVal(Pnl, Text, ReadOffMemoryStatus());
    break;
    return 0;
    int CVICALLBACK cb_Quit(int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2) {
    switch (event) {
    case EVENT_COMMIT: QuitUserInterface (0); break;
    return 0;
    int main (int argc, char *argv[]) {
    int i, Quit;
    if (InitCVIRTE (0, argv, 0) == 0) return -1;
    Pnl = NewPanel (0, "Test image ring", 20, 20, Height+20, Width);
    Text = NewCtrl (Pnl, CTRL_STRING_LS, "Memory use (in 4Kb pages)", 0, 0);
    Ring = NewCtrl (Pnl, CTRL_PICTURE_RING, "", 20, 0);
    Quit = NewCtrl (Pnl, CTRL_SQUARE_BUTTON_LS, "", 50, 50);
    SetCtrlAttribute(Pnl, Ring, ATTR_HEIGHT, Height);
    SetCtrlAttribute(Pnl, Ring, ATTR_WIDTH, Width);
    SetCtrlAttribute (Pnl, Ring, ATTR_CTRL_MODE, VAL_HOT);
    SetCtrlAttribute(Pnl, Ring, ATTR_CALLBACK_FUNCTION_POINTER, cb_Change);
    for (i=0; i<NbVals; i++) Prepare(i);
    SetCtrlAttribute(Pnl, Text, ATTR_WIDTH, 250);
    SetCtrlAttribute(Pnl, Text, ATTR_LABEL_LEFT, 250);
    SetCtrlAttribute(Pnl, Text, ATTR_LABEL_TOP, 0);
    SetCtrlAttribute(Pnl, Quit, ATTR_CALLBACK_FUNCTION_POINTER, cb_Quit);
    SetCtrlAttribute(Pnl, Quit, ATTR_VISIBLE, 0);
    SetCtrlAttribute(Pnl, Quit, ATTR_SHORTCUT_KEY, VAL_ESC_VKEY);
    SetPanelAttribute(Pnl, ATTR_CLOSE_CTRL, Quit);
    DisplayPanel (Pnl);
    RunUserInterface ();
    return 0;
    There are other issues as well:
     - CanvasDrawPoly sometimes doesn't work.
     - The anti-aliasing on a canvas doesn't compile.
    Is there anything more recent than CVI 2010 for Linux ?!?

  • Memory leak - Node clean up?

    Hey guys,
    I'm running into a memory leak and was reading some other threads where people were having their own memory leaks. Is there a way through NetBeans to track memory usage or something to figure out what is consuming memory? My memory leak sounds similar to this gentleman's: [http://forums.sun.com/thread.jspa?threadID=5409788] and [http://forums.sun.com/thread.jspa?threadID=5357401]
    Setup:
    I have a mySQL database call that returns a bunch of results and in the end converts each record into its own custom node which then gets put into a sequence, which is then given to a listEventsNode (a custom node VBox) and finally put on the stage. As a note each custom node has its own animations, events, images, and shapes.
    listEventsNode gets its list of custom nodes from a publicly accessible sequence variable where its contents is simply cleared and new nodes are added by the next MySQL search. I cleared the eventSequence by using delete myCustomNodeSequence.
    I even go as far as setting the same sequence null (myCustomNodeSequence = null;). This unfortunately doesn't make any difference in terms of memory usage. java.exe will reach 100MB then crash.
    the listEventsNode is bound with eventSequence, this is to ensure that changes to the sequence of custom nodes are immediately reflected in the Vbox (listEventsNode).
    ListEventsNode is on the main stage and there is only one instance of it, but what changes is the content in the eventSequence. Even if I clear the contents of the eventSequence, it doesn't appear to "clean up" the memory.
    The way I'm doing it is probably breaking every rule in the book. I should probably make it so listEventsNode is its own object which isn't bound to any external variables (such as eventSequence) and in the event a new search takes place I simply delete the listEventsNode and when a new search is complete, it re-adds the node to the scene. Am I on the right track here?
    Is there a good "best practices" for JavaFX? For example, a typical mistake that would cause a node to "recreate" itself over and over again in memory when the programmer may have thought it was simply being "written over"? Does this make sense? Because I have a feeling that my application is not deleting the custom nodes that were created for the eventSequence and even if the eventSequence is "deleted" and re-assigned with new custom nodes, the original or previous custom nodes are still residing in memory.
    Let me know if you need to see the source or any logs/readouts from NetBeans during execution if this will help.
    Thanks for taking the time to read this.
    Cheers,
    Nik.

    Your heap usage looks pretty typical. In scenario 5, I think you are simply running out of memory. I doubt its a leak inside the javafx runtime (although it could be).+
    I think you might be right. It's running out of memory and I may have to increase the heap size.
    Say that my application legitimately needs more memory to operate, and I need to increase the heap size. How does this work if you have a fully deployed application? Is the heap size information built into the application itself so that when the jvm runs the application, it allocates the appropriate amount of memory? I've increased the heap size from 64mb to 128mb, and I added many many nodes and I still crapped out when I hit the 128mb ceiling. I changed it to 512 and I added a TON of nodes (when you click a node from the VBox, it adds a miniature version of the node to the scene graph) and I'm just under 200MB. I plan on setting a cap to how many concurrent additional nodes can be placed on the scene graph, which will help.
    If you deploy this as is, how does the application utilize memory if you've adjusted the heap size? Or is this specific to the IDE only?
    Do you know what objects are on the heap? Can you compare what objects are on the heap from one scenario to the next?+
    Where can I find this information in NetBeans profiler?
    Do you have a lot of images? Are they thumbnails or are they images scaled down to thumbnail size?+
    Actually, yes I am using a scaled down thumbnail size of the original image. The original image files are PNG format, 60x60 pixels, and about 8kb in size. I simply use the "FitWidth:" property to scale the image down. I was doing some more reading before I went to bed and I was going to use an alternative way to scale the image down. By simply doing this, the initial heap usage off the 500 node search went down form 44MB to 39MB. It's still slower on consecutive searches versus the first, but it's stable.
    Edit: I've used the width: property to downsize the image and it looks like I'm not running into that heap crash as fast but this poses a problem where I need to have the full size of the image available when a custom node is selected. What's the best way of doing this? I should probably store the image location in a string and recreate the image when I need it in full size since there is only one full size version of it on the screen at a given time. I've also completely disabled the addition of a picture in my custom node; it appears these images don't take up a lot of space since they are very small. I save an additional 3-5MB in heap space if I completely disable the pictures and have just the nodes themselves. Each node has animation effects (i.e. fading in/out of colors, changing of color if selected). Although the class itself is pretty dang long in comparison with any other classes I have.
    Are you clearing the nodes from your scene content before the search or after? If after, are you creating the new nodes before clearing out the old?+
    Yes, I have a function that reassigns the stage.scene.content sequence omitting the custom vbox that houses the list of custom nodes prior to the next search. The "cleanUp()" function is called prior to the insertion of the new custom vbox.
    It might be useful to turn on verbose garbage collection (-verbose:gc on the java command line) just to see what's happening in gc.+
    What is this exactly? I tried putting in System.gc() but I'm not sure if I'm seeing any difference yet.
    Edit: Actually, I've placed System.gc() after I run my cleanUp() function and I'm noticing the heap usage is more conservative. Seems to clear more often than it did before. But yes, the underlying problem of my running out of memory is to be looked at.
    You might also (just as an experiment) force garbage collection between your searches.+
    This seems to work well with smaller result sets. However, a search that produces over 500 custom nodes in a custom VBox uses more than half of the available heap size, so the next time it tries to do the same search it just crashes like you mentioned in your first point. The memory simply runs out. What I don't get is if I "delete" the custom vbox prior to inserting it, the memory doesn't seem to be released immediately. From what I'm reading about the garbage collector, it doesn't exactly do things in a prompt fashion.

  • Memory leak in UIButton setFont method

    Hi,
    Hope you all doing well, I am getting a memory leak while setting the font of UIButton. This is the code which I am using to set the font,
    [MyBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
    whereas MyBtn is connected to IBOoutlet and I am not allocating memory to it.
    I don't see any thing wrong in the code. Hopefully someone will help me out, I will be really thankful.

    In instrument the responsible library is UIKit and UILabel is the leaked object so I am also not sure whether instrument is pointing the right line or not.
    Below is the function in which I am getting the leak,
    - (void) LayoutUI
    [bgImageView setImage:[UIImage imageNamed:@"bgImage.png"]];
    [topImageHeaderView setImage:[UIImage imageNamed:@"headerImage.png"]];
    [logoImageView setImage:[UIImage imageNamed:@"logo.png"]];
    [HeaderImageView setImage:[UIImage imageNamed:@"headerImageView.png"]];
    [BackBtn setTitle:@"Back" forState:UIControlStateNormal];
    [BackBtn.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];
    [BackBtn setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    //below is the Leaked line of code
    [BackBtn.titleLabel setTextColor:[UIColor colorWithRed:(50.0/256.0) green:(100.0/256.0) blue:(200.0/256.0) alpha:1]];
    [headerLbl setText:@"Header"];
    //below two lines are leaked
    [headerLbl setFont:[UIFont boldSystemFontOfSize:12]];
    [headerLbl setTextColor:[UIColor colorWithRed:(50.0/256.0) green:(100.0/256.0) blue:(200.0/256.0) alpha:1]];
    hopefully this will show a picture of what I am doing in my code.
    One more thing all these UIlabels and UIImage are connected to IBOoutlet so I am not allocating memory to any of them but though I have tried to dealloc all of them in dealloc method but it didn't help me out.

  • Memory leak in JDK5

    Folks,
    I develop a Java application (non-J2EE) which is highly multithreaded and runs on server class machines. One of the recent changes we made to the application was to replace a bunch of JNI code with pure Java code.
    Load tests of our application show a very prett Java-side picture (as seen from JConsole). We see the familiar sawtooth heap usage graph with no rising trend. When we switch to Windows perfmon, however, the picture is very different. The process' private bytes show a steady increase of about 4M/hour. The handle count also shows a monotonically rising curve.
    So far we have tried the following:
    -Updated JDK from JDK 5u5 to JDK 5u10: no impact
    - Changed garbage collectors from the default (conc mark sweep compact) to ParallelGC: This changed the trend slighly but still a rising trend.
    Through all of the above, the Java-side things still look pretty.
    I could attach graphs from perfmon showing the private byte and handle trends.
    Does anyone have ideas on what is the best way to proceed? How do I narrow it down further?
    One of the recent changes was to integrate NIST SIP stack. Is that code known to trigger a JVM memory leak?
    Thanks.
    -Raj

    It looks like we found the bug which is the root cause: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=12d672291c95e52a1f6916c59d7:WuuT?bug_id=6434648
    Thanks.
    -Raj

  • How can memory leaks occur?

    Hi,
    I was just wondering how a memory leak can occur in Java. The garbage collector is supposed to free up all unused variables, so under what circumstances can it happen?

    This is not technically a "memory leak". I've seen
    this called "loitering objects", which conjures upa
    vivid picture: objects hanging around with nothingto
    do...I think it's the classic java memory leak. A bug in
    a program that prevents the freeing up of memory that
    it no longer needs.Yes, but it's not what is traditionally termed a memory leak.
    A real memory leak is memory that's claimed by the program but no longer accessible to the program for freeing up.
    That can in Java (where what we call a program isn't a complete program but runs inside a virtual machine which handles memory allocation and deallocation) only happen if there's a flaw in the JVM itself which causes errors in memory deallocation (so most likely a flaw in the garbage collector).
    In Java the objects you create are always out there somewhere where something can reach them so as to prevent them from being available to the garbage collector.
    Different cause, same effect in that in both cases memory isn't getting freed for reuse.

  • EAGL - Double allocation of texture memory?

    Hello-
    I am using a 1024x1024 texture page in Opengl, and everything loads and displays fine. However when looking in Leaks tool, I see that the memory for the texutre page is double what it should be. (1024x1024x4 = 4.4mb, but 8.8 are allocated). I'm using code based on the Apple default OpenGL ES project. I think I'm freeing everything possible. Leaks says that either GLClear or GLRendererFloat are malloc'ing 4.2 mb.. Any ideas? Here is my texture loading code:
    spriteImage = [UIImage imageNamed:[list objectAtIndex:i]].CGImage;
    // Get the width and height of the image
    width = CGImageGetWidth(spriteImage);
    height = CGImageGetHeight(spriteImage);
    // Texture dimensions must be a power of 2. If you write an application that allows users to supply an image,
    // you'll want to add code that checks the dimensions and takes appropriate action if they are not a power of 2.
    if(spriteImage) {
    // Allocated memory needed for the bitmap context
    spriteData = (GLubyte *) malloc(width * height * 4);
    // Uses the bitmatp creation function provided by the Core Graphics framework.
    spriteContext = CGBitmapContextCreate(spriteData, width, height, 8, width * 4, CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast);
    // After you create the context, you can draw the sprite image to the context.
    CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)width, (CGFloat)height), spriteImage);
    // You don't need the context at this point, so you need to release it to avoid memory leaks.
    CGContextRelease(spriteContext);
    // Use OpenGL ES to generate a name for the texture.
    glGenTextures(1, &spriteTextures);
    // Bind the texture name.
    glBindTexture(GLTEXTURE2D, spriteTextures);
    // Speidfy a 2D texture image, provideing the a pointer to the image data in memory
    glTexImage2D(GLTEXTURE2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GLUNSIGNEDBYTE, spriteData);
    // Release the image data
    free(spriteData);
    glTexParameteri(GLTEXTURE2D, GLTEXTURE_MINFILTER, GL_LINEAR);
    glTexParameteri(GLTEXTURE2D, GLTEXTURE_MAGFILTER, GL_LINEAR);
    CGContextRelease(spriteContext);
    CGImageRelease(spriteImage);
    Thank you very much

    There shouldn't be any issues with freeing spriteData as you did in the original example. You should be able to use leaks to verify where all surviving allocations are from, and determine that it isn't spriteData.
    The software renderer used by the simulator is quite different than the OpenGL implementation on the device. You should use leaks on the device and verify that the problem does, or does not, occur there. If it is Sim only, don't worry about it.

  • 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();
    }

  • Is memory leak Problem Solved in this new FW 4.08...

    Hi frnds,This is my very first post. Im happy to be a member of N Series Family by owing a brand New N73 ME One Week Before (July 2008). The phone really Fascinated me with its features, Since my Previous Phone was Nokia 6630. Now let me Come to my problem.
    A "Memory Full. Close some application" Error is encountering me twice or thrice a day. if i knowledge is correct, its Low RAM error & i found my RAM in the range of 18-20MB just after startup & along with usage of applications & closing, it maintain a range b/w 4-8MB. In this time wen i open a picture in inbuilt PicEditor this Memory full Error occurs(And sometimes while zooming a picture in gallery also). Will updating to the new FW according to my product code 0543843 is 4.0812.4.2.1 will solve the Memory leak problem ? i have gone through all the post regarding the issues on latest firmware updates Good & Bad. So im a bit confused that shud i update or not. Coz i have only this memory problem. Everything else is fine.
    Please help me.
    N73 ME
    v 4.0736.3.2.1
    04-09-2007
    RM-133
    Code:0543843
    INDIA

    I have 4.0812.4.2.1 and I have the same problem..I think that in 4.0736 is best memory usage than other firmwares,but I can't downgrade firmware

  • 2014.2 Crash by scrubbing - serious memory leak? (screenshot attached)

    Hello. I've bought one year premiere pro cc plan. After upgrate from 2014.1 to 2014.2 I suffer with many crashes a day. I can't roll back, because I am in the middle of the feature film edit and new files are not opened by 2014.1
    The most anoying crash is about memory use growth.
    First - my system and sequence specs:
    I have 48gb ram, intel i73930k processor, 4TB main drive and 3x250SSD drives for scratch disks. My Gpu is 2 x nvidia gtx 780 (3gb ram each). I work in 4k workspace and with uhd timeline 2.35 : 1 ratio. (3840x1628)
    Second - how to crash.
    I open the pproj file (about 8mbytes in size). It is a full feature film, i edit it in 3 parts for better performance. My main codec is cineform, both for HD previews and final 4K encoding.
    Then I move playhead over any clip  already rendered with preview (HD - mpeg or cineform).
    Then I hold left mouse button and I start to scrub playhead left/right randomly along timeline, the problem unfolds: ram usage starts to go up, after some time of scrubbing it hits the ceiling and premiere crashes (along with eventual other apps opened as firefox).
    It seems like premiere is registering every displayed frame in memory, even if it is already rendered as preview. And there is no limit set for doing this, so it overflows and crash.
    As you see on the picture, in preferences there is 8GB reserved for other apps, and optimization for memory set.
    Scrubbing over non-rendered clips makes ram eating even worse, crash occurs earlier.
    I wonder - do you people have this similar problem? Could someone reproduce this inside any larger project (30 minutes of standard movie edit).
    I would like to find solution, because I cant allow for so many crashes during serious production workflow.
    nl

    I'm having the same problem too.
    I've been posting my issues on another post entitled, "Just spent $7000. on new custom computer and PremiereProcc2014 crashing". (see my NEW profile computer specs as of two weeks ago)
    I've been experiencing about 25 crashes in an 8 hour period. Some after 1/2 hour and others back to back crashes.
    I didn't even think of why it was crashing until I called support, whereas they took over my computer and showed me that even when timeline is PAUSED, YES EVEN JUST PAUSED, we watched the RAM clime and clime to the ceiling until Premiere crashed.
    It's so frigg'in frustrating that people here are complaining and there seem to be absolutely no talk about this issue. It's probably the cause of many Premiere issues, in my humble opinion.
    Strangely enough, the tech fixed the problem (but this has been happening to me often and even with my older computer). Anyway he stopped several Adobe related running programs in the background, and took my timeline to a new project.
    Basically, I'm not sure exactly what he did to solve the problem, and sadly I suspect it will return as it always has done so.
    One strange note is that he reset all my preferences back to the defaults. I'm talking about maybe 15 presets that I have including a handful of changed key-strokes (to my liking), and simple things like "double-click opens in same folder" and "don't replay timeline after rendering" and "don't go to beginning of project after end of play-line" and changed around my user interphase to my liking.
    These type of customization shouldn't cause Memory Leaks? I just don't get it.

  • Can I locate "memory leaks" to keep apps from crashing?

    Hello clever people,
    Since the iPhone 4s is still on the market, I assume that my 2 year old 4s should be able to work fine. However, I am constantly plagued by apps crashing and, most frustratingly, apps often fail to remain running in the background, even with one or no other apps running.
    I had a similar issue with my iPad2, just before it ran out of applecare, and the chap had me run through with sending anaylitcs to him, and his conclusion was that a few apps were causing 'memory leaks' - had me reset the iPad and reinstall everything. So I also did this on the iPhone, which did help, but it has not solved the issue. I have also removed most apps from the device, in a bid to locate the offending app.
    Searching on Google for "memory leak" only brings up info for developers, and nothing for someone who is actually using their phone and having issues. My usual scenario is going for a bike ride and running Strava, which then cuts out when I stop to take a picture - with no other apps running.
    Does anyone know how to solve the issue - return the phone to its 'as new' state, or locate the problem and remove it?
    Cheers,
    Tobias

    There are differenty types of, "resets" ..
    Have you tried the folloiwng ??
    Reset the device:
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    If that doesn't help, tap Settings > General > Reset > Reset All Settings
    No data is lost due to a reset.
    Use iTunes to restore your iOS device to factory settings

Maybe you are looking for