Runnable Class doubles memory need of application

Hi
I use a class called DisplayTimer to throw an event every second. This class is Runnable and runs as an own thread. Then I have OrientedText2D Object in a java3d environment that listen to these events and update their caption (countdown time) every time they receive an event. So far so good, the solution works. BUT the memory need of my application doubles when i .start() the Runnable DisplayTimer class to start the event-throwing for the countdown captions...
Here is the DisplayTimer class:
import java.util.*;
import de.qtobe.events.*;
import de.qtobe.tools.*;
public class DisplayTimer implements Runnable {
    private List _listeners = new ArrayList();
    Thread t;
    public DisplayTimer() {
        t = new Thread(this);
        t.start();
    public void run() {
        while (true) {
            _fireUpdateNotificationEvent();
            //Runtime r = Runtime.getRuntime();
            //System.out.println("before: " + r.freeMemory());
            //r.gc();
            //System.out.println("after: " + r.freeMemory());
            try {
                Thread.currentThread().sleep(900);
            } catch (java.lang.InterruptedException e) {
                Log.log("Error in DisplayTimer occured.");
    public synchronized void addUpdateNotificationListener(UpdateNotificationListener l) {
        _listeners.add(l);
    public synchronized void removeMoodListener(UpdateNotificationListener l) {
        _listeners.remove(l);
    private synchronized void _fireUpdateNotificationEvent() {
        UpdateNotificationEvent updateNotification = new UpdateNotificationEvent(this, false);
        Iterator listeners = _listeners.iterator();
        while (listeners.hasNext()) {
            ((UpdateNotificationListener) listeners.next()).updateNotificationReceived(updateNotification);
        updateNotification = null;
        listeners = null;
}This is how the listeners react:
    public void updateNotificationReceived(UpdateNotificationEvent event) {
            if (this.impactInfo != null) {
                //Ausgabe kommt in die "Machine"
                //String caption = "Remaining service time: " + this.impactInfo.getFormattedRemainingServiceTime();
                //caption += ", Countdown to breach of contract: " + this.impactInfo.getFormattedCountdown();
                String caption = "" + this.impactInfo.getFormattedCountdown();
                caption += " (remaining fullfill time: " + this.impactInfo.getFormattedRemainingServiceTime() + ")";
                this.setCaption(caption);
                if (impactInfo.getCountdownBreachContract() <= 0) {
                    this.setCaptionColor(Def.COLOR_RED);
                } else {
                    this.setCaptionColor(Def.COLOR_HOTRED);
                caption = null;
            }The events transport no information or data btw.
Does anyone have an idea how I can optimize this solution?
Thanks in advance!

The common understanding is that the swf is loaded into memory at once and in full, and so embedded assets take up initial memory based on how much they contribute to the SWF size even before any of them get instantiated into their runtime class form.  This is certainly the case for Android or desktops that use the SWF, it isn't clear if the native iOS compiling ends up treating the embedded assets memory footprint in the same way or not, but possible.
There is a compiler flag which you can add called -size-report=report.xml that can give you a complete breakdown of how  each type of data within the SWF contributes to the size in compressed form. It is most likely this memory footprint that contributes to loading the SWF (independent of actually instantiating or hydrating any of the embedded assets).
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf67110-7ff4.html#WS19 f279b149e7481c45454d9412c561d3223-8000
There most likely are others here that know more details or might even want to correct some of these assumptions, but that is why most mobile developers choose to load assets from the filesystem if possible as opposed to embedding assets to avoid the extra memory hit on the initial SWF loading into memory.

Similar Messages

  • Updating a GUI component from a runnable class that doesn't know that GUI

    Hi. I have a problem that I think isn't solvable in an elegant way, but I'd like to get confirmation before I do it the dirty way.
    My application allows the user to save (and load) his work in sessions files. I implemented this by a serializable class "Session" that basically stores all the information that the user created or the settings he made in its member variables.
    Now, I obviously want the session files created by this to be as small as possible and therefore I made sure that no GUI components are stored in this class.
    When the user has made all his settings, he can basically "run" his project, which may last for a long time (minutes, hours or days, depending on what the user wants to do....). Therefore I need to update the GUI with information on the progress/outcome of the running project. This is not just a matter of updating one single GUI component, but of a dynamic number of different internal frames and panels. So I'd need a reference to a GUI component that knows all these subcomponents to run a method that does the update work.
    How do I do that? I cannot pass the reference to that component through the method's argument that "runs" the project, because that needs to be a seperate thread, meaning that the method is just the run() method of that thread which has no arguments (which I cannot modify if I'm not mistaken).
    So the only thing I can think of is passing the reference through the constructor of the runnable class (which in turn must be stored in the session because it contains critical information on the user's work). As a result, all components that need to be incorporated in that updating process would be part of the session and go into the exported file, which is exactly what I wanted to avoid.
    I hope this description makes sense...
    Thanks in advance!

    Thanks for the quick answer! Though to be honest I am not sure how it relates to my question. Which is probably my fault rather than yours :-)
    But sometimes all it takes me to solve my problem is posting it to a forum and reading it through again :)
    Now I wrote a seperate class "Runner" that extends thread and has the gui components as members (passed through its constructor). I create and start() that object in the run method of the original runnable class (which isn't runnable anymore) so I can pass the gui component reference through that run method's argument.
    Not sure if this is elegant, but at least it allows me to avoid saving gui components to the session file :-)
    I am realizing that probably this post shouldn't have gone into the swing forum...

  • Order of class loading in a Web Application

    Hi,
    I have been trying to find out if there is a defined order in which classes contained in WEB-INF/classes
    and/or WEB-INF/lib should be loaded.
    There doesn't appear to be any mention of class loading order in either the J2EE 1.3 or J2EE 1.4
    specifications. That does not mean that there isn't a defined class load order, it just means I haven't found one.
    Typical behaviour from servers such as Tomcat (reference implementation of the Servlet Engine) show
    that classes in WEB-INF/classes are loaded before classes contained in jars under WEB-INF/lib.
    Because there doesn't appear to be a mandated class load order I cannot assume that the same
    behaviour holds for all servers, unless someone here knows better of course.
    The reason for the question is that relying on the exhibited class load order means we can patch web applications by simply putting the patch under the WEB-INF/classes directory.
    If this should not be relied upon then patches will have to be applied directly to the affected jar files,
    this is not a problem in itself however it is nice to be able to keep the patches out of the jars for
    ease of rolling back patches without having to copy jar files all over the place.
    Any insights would be welcome.
    Thanks

    If you say that it is server specific i don't find
    that to be the correct answer b'cozI didn't give an answer, I am looking for one. I gave an example of the behaviour that Tomcat 4.1.x
    exhibits, one that we currently make use of for patching web applications. My question was about
    whether or not this behaviour can be relied upon.
    the class files are depended on the jar files which
    need to checked in first before getting loaded b'coz
    it should check for dependent files before only while
    getting deployed.This is why the class load order is important.
    Is the Web Application Classloader going to look in WEB-INF/classes first every time followed
    by WEB-INF/lib everytime, is the order undefined, or is it reversed?
    More over if you just think of class loading mechanism
    of classes folder only then it is loaded in the order
    specified in the web.xml file.
    in this we specify the order of loading.As far as I know web.xml does not allow you to specify where classes should be loaded from and in
    which classpath order, you define which classes should be used for application components.
    The only load order you can specify is the load order of servlets on startup.
    If you know different I would love to know how you would configure web.xml to specify the classpath order
    in which classes are loaded.

  • Adjust memory pool after application launched

    Hi, all
    Is it possible to change memory pool after application launched? For example, in command line 'javaw -Xms32m -Xmx64m' and I want to double it after launched. If it is possible, how can I do that?
    Thanks,
    Vincent Chen

    You cannot change the limits once the JVM is running.
    Maybe you can use Runtime.exec() to start a new JVM with higher limits?

  • HT1379 add V memory to an application, Sweet Home 3D

    need to add virtual memory to an application for better performance, Sweet Home 3D

    Mac OS X does not give, the application takes.  If Sweet Home 3D wants more virtual memory it just allocates it as part of the code.
    If the program is a 32-bit program, then it will be limited to 4GB of virtual memory address space, which includes all the program code, libraries, execution stack and the program's data.
    If the program is 64-bit, it will be able to use huge amounts of virtual memory.
    You can look at Applications -> Utilities -> Activity Monitor -> "Kind" to see if it is "intel (64-bit)".
    But there is nothing you can personally do to control the amount of virtual memory a program uses.
    Klaus1 wrote:
    OS X moves to virtual memory when you have run out of available RAM.
    Virtual Memory is ALWAYS used.  You are thinking paging to disk when there is not enough RAM to hold the entire program and all the other things running on a Mac.
    However, if ccoste25 is running out of physical disk space, that might affect the ability to page RAM to disk.
    Also if there are lots and lots of programs using lots and lots of virtual memory, Mac OS X may run out of room to maintain virtual page tables and give an error saying not enough space for applciation memory.

  • My MacBook pro 2012 Mountain Loin 8.2 don't clear the inactive memory automatically when memory needed for other program so I get page outs.

    My MacBook Pro 2012 Mountain Loin 8.2 doesn't clear the inactive memory automatically when memory needed for other program so I get page outs. There are much inactive memory when page outs. Why my mac does this?

    That's completely normal. If other programs require memory then the system will reallocate Inactive RAM as needed. Page Outs don't mean anything.
    About OS X Memory Management and Usage
    Reading system memory usage in Activity Monitor
    Memory Management in Mac OS X
    Performance Guidelines- Memory Management in Mac OS X
    A detailed look at memory usage in OS X
    Understanding top output in the Terminal
    The amount of available RAM for applications is the sum of Free RAM and Inactive RAM. This will change as applications are opened and closed or change from active to inactive status. The Swap figure represents an estimate of the total amount of swap space required for VM if used, but does not necessarily indicate the actual size of the existing swap file. If you are really in need of more RAM that would be indicated by how frequently the system uses VM. If you open the Terminal and run the top command at the prompt you will find information reported on Pageins () and Pageouts (). Pageouts () is the important figure. If the value in the parentheses is 0 (zero) then OS X is not making instantaneous use of VM which means you have adequate physical RAM for the system with the applications you have loaded. If the figure in parentheses is running positive and your hard drive is constantly being used (thrashing) then you need more physical RAM.
    Adding RAM only makes it possible to run more programs concurrently.  It doesn't speed up the computer nor make games run faster.  What it can do is prevent the system from having to use disk-based VM when it runs out of RAM because you are trying to run too many applications concurrently or using applications that are extremely RAM dependent.  It will improve the performance of applications that run mostly in RAM or when loading programs.

  • Keep class in memory

    Hello,
    I have a class to pool db connections.
    When I first connect to the site there is a delay loading the page which I think may be caused by this class being instantiated.
    Is it possible to keep this class in memory after it goes out of scope, avoiding garbage collection.
    If this can be done, is it a good idea??
    Thanks

    Put the object into Application scope as an attribute.
    As long as your server is running, It will never go out of scope, and always be available, to all web applications.
    Or if you have a singleton object, you have a static reference to the resource. That should never go out of scope.
    As a matter of interest how much of a "re-connect" delay are we talking about? A few seconds? 30 seconds?
    If its such a bad idea, why were the pooling API's written??They are not saying that pooling is a bad idea, but rather writing your own code to perform a function that the container already provides very efficiently.
    You counter that argument by saying you want your code to be completely server independant. Fair enough.
    When I first connect to the site there is a delay loading the page which
    I think may be caused by this class being instantiated.The operative word here: think.
    Put some timing/profiling code into your class to see how much time it is taking. Record System.currentTimeMillis() when the class is initialized, when you start running your "getConnection()" and when it returns control to the calling object.
    That should help you determine exactly where the process is being slow - whether it is the running of that class, or something else.
    Good luck,
    evnafets

  • How do I fix the following error, it comes up every time I open a Firefox page; "type error: Components.classes[cid] is undefined" (JavaScript Application)

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    how do I fix the following error, it comes up every time I open a Firefox page; "type error: Components.classes[cid] is undefined" (JavaScript Application)
    == This happened
    ==
    Every time Firefox opened
    == a few months ago
    ==
    == Troubleshooting information
    ==
    Application Basics
    Name Firefox
    Version 3.6.3
    Profile Directory
    Open Containing Folder
    Installed Plugins
    about:plugins
    Build Configuration
    about:buildconfig
    Extensions
    Name
    Version
    Enabled
    ID
    Adblock Plus 1.2 true
    Adobe DLM (powered by getPlus(R)) 1,6,2,49 true
    AVG Safe Search 9.0.0.825 true {3f963a5b-e555-4543-90e2-c3908898db71}
    AVG Security Toolbar 4.504.019.002 true avg@igeared
    Fasterfox 2.0.0 false
    Forecastfox 0.9.10.2 true {0538E3E3-7E9B-4d49-8831-A227C80A7AD3}
    Java Console 6.0.05 true
    Java Console 6.0.03 true
    Java Console 6.0.07 true
    Java Console 6.0.11 true
    Java Console 6.0.13 true
    Java Console 6.0.15 true
    Java Console 6.0.17 true
    Java Quick Starter 1.0 true [email protected]
    Microsoft .NET Framework Assistant 1.2.1 true {20a82645-c095-46ed-80e3-08825760534b}
    NoScript 1.9.9.77 true {73a6fe31-595d-460b-a920-fcc0f8843232}
    Java Console 6.0.19 true
    Java Console 6.0.20 true
    Modified Preferences
    Name
    Value
    accessibility.typeaheadfind.flashBar 0
    browser.history_expire_days 0
    browser.history_expire_days.mirror 180
    browser.places.importBookmarksHTML false
    browser.places.importDefaults false
    browser.places.leftPaneFolderId -1
    browser.places.migratePostDataAnnotations false
    browser.places.smartBookmarksVersion 2
    browser.places.updateRecentTagsUri false
    browser.startup.homepage_override.mstone rv:1.9.2.3
    extensions.lastAppVersion 3.6.3
    general.useragent.extra.microsoftdotnet ( .NET CLR 3.5.30729)
    keyword.URL http://au.yhs.search.yahoo.com/avg/search?fr=yhs-avg&type=yahoo_avg_hs2-tb-web_au&p=
    network.cookie.prefsMigrated true
    places.last_vacuum 1272511429
    print.print_bgcolor false
    print.print_bgimages false
    print.print_command
    print.print_downloadfonts true
    print.print_evenpages true
    print.print_in_color true
    print.print_margin_bottom 0.5
    print.print_margin_left 0.5
    print.print_margin_right 0.5
    print.print_margin_top 0.5
    print.print_oddpages true
    print.print_orientation 0
    print.print_pagedelay 500
    print.print_paper_data 0
    print.print_paper_height 11.00
    print.print_paper_size -134744073
    print.print_paper_size_type 1
    print.print_paper_size_unit 0
    print.print_paper_width 8.50
    print.print_printer Lexmark 4200 Series
    print.print_reversed false
    print.print_scaling 1.00
    print.print_shrink_to_fit true
    print.print_to_file false
    print.printer_Lexmark_4200_Series.print_bgcolor false
    print.printer_Lexmark_4200_Series.print_bgimages false
    print.printer_Lexmark_4200_Series.print_command
    print.printer_Lexmark_4200_Series.print_downloadfonts true
    print.printer_Lexmark_4200_Series.print_edge_bottom 0
    print.printer_Lexmark_4200_Series.print_edge_left 0
    print.printer_Lexmark_4200_Series.print_edge_right 0
    print.printer_Lexmark_4200_Series.print_edge_top 0
    print.printer_Lexmark_4200_Series.print_evenpages true
    print.printer_Lexmark_4200_Series.print_footercenter
    print.printer_Lexmark_4200_Series.print_footerleft &PT
    print.printer_Lexmark_4200_Series.print_footerright &D
    print.printer_Lexmark_4200_Series.print_headercenter
    print.printer_Lexmark_4200_Series.print_headerleft &T
    print.printer_Lexmark_4200_Series.print_headerright &U
    print.printer_Lexmark_4200_Series.print_in_color true
    print.printer_Lexmark_4200_Series.print_margin_bottom 0.5
    print.printer_Lexmark_4200_Series.print_margin_left 0.5
    print.printer_Lexmark_4200_Series.print_margin_right 0.5
    print.printer_Lexmark_4200_Series.print_margin_top 0.5
    print.printer_Lexmark_4200_Series.print_oddpages true
    print.printer_Lexmark_4200_Series.print_orientation 0
    print.printer_Lexmark_4200_Series.print_pagedelay 500
    print.printer_Lexmark_4200_Series.print_paper_data 1
    print.printer_Lexmark_4200_Series.print_paper_height 11.00
    print.printer_Lexmark_4200_Series.print_paper_size -134744073
    print.printer_Lexmark_4200_Series.print_paper_size_type 0
    print.printer_Lexmark_4200_Series.print_paper_size_unit 1
    print.printer_Lexmark_4200_Series.print_paper_width 8.50
    print.printer_Lexmark_4200_Series.print_reversed false
    print.printer_Lexmark_4200_Series.print_scaling 1.00
    print.printer_Lexmark_4200_Series.print_shrink_to_fit true
    print.printer_Lexmark_4200_Series.print_to_file false
    print.printer_Lexmark_4200_Series.print_unwriteable_margin_bottom 0
    print.printer_Lexmark_4200_Series.print_unwriteable_margin_left 0
    print.printer_Lexmark_4200_Series.print_unwriteable_margin_right 0
    print.printer_Lexmark_4200_Series.print_unwriteable_margin_top 0
    privacy.clearOnShutdown.cookies false
    privacy.clearOnShutdown.offlineApps true
    privacy.cpd.cookies false
    privacy.item.offlineApps true
    privacy.sanitize.migrateFx3Prefs true
    privacy.sanitize.timeSpan 3
    security.warn_viewing_mixed false
    security.warn_viewing_mixed.show_once false
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows XP
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)
    == Plugins installed
    ==
    *-getplusplusadobe16249
    *Office Plugin for Netscape Navigator
    *Adobe PDF Plug-In For Firefox and Netscape
    *Default Plug-in
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Shockwave Flash 10.0 r45
    *iTunes Detector Plug-in
    *Garmin Communicator Plug-In 2.8.1.0
    *Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
    *Java(TM) Platform SE binary
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    *Npdsplay dll
    *DRM Store Netscape Plugin
    *DRM Netscape Network Object

    How do I fix this problem ...javascript (cid) applications.

  • Do I need adobe application manager? and what does it do? can i uninstall it on Mac OS X Mavericks?

    Do I need adobe application manager? and what does it do? can i uninstall it on Mac OS X Mavericks?

    The application manager provides activation and online features, so no, unisntalling is not an option or else your Adobe software would go defunct.
    Mylenium

  • I need an application that will turn off my iPhone on the home screen just by a one click since my power button has sank and is no longer working--anyone have ideas?? I don't like having to use assistive touch and hit three buttons to lock my screen

    I need an application that will turn off my iPhone on the home screen just by a one click since my power button has sank and is no longer working--anyone have ideas?? I don't like having to use assistive touch and hit three buttons to lock my screen

    No such app exisits or can exist.  Apple doesn't allow 3rd party apps to access core functions of the phone.  Time to get your phone replaced or repaired if assistive touch doesn't needs your needs.

  • HT1222 My mouse pointer in finder is not working by double clicking on the application.I have to double click and select open for opening the application.Can you suggest me some settings to fix this problem?

    My mouse pointer in finder is not working by double clicking on the application.I have to double click and select open for opening the application.Can you suggest me some settings to fix this problem?

    Hi,
    Try this ... reboot your Mac and see if double clicking works again.
    Also, you can just select the Application you like to open and hold down the Command+O to open.
    Also, did you check your setting for the mouse in system preferences.
    Dimaxum

  • Class file/memory mismatch

    I ma trying to compile a source code in 64 bit Solaris. The same code works fine with 32 bit but on 64bit it shows the following error -
    ld: elf error: file /usr/users/PLAT/cltxm25/atm/generic_archive-smdxp83/generic_archive/tlvcreation.a(keyfields_populate.o): elf_getshdr: Request error: class file/memory mismatch
    ld: elf error: file /usr/users/PLAT/cltxm25/atm/generic_archive-smdxp83/generic_archive/tlvcreation.a(tlvcreation_populate.o): elf_getshdr: Request error: class file/memory mismatch
    I check $file keyfield_populate and it is ELF 64-bit MSB relocatable SPARCV9 Version 1. Same is the case with tlvcreation_populate.o
    Please advice something on this.

    i got the same error when compiling hypre (http://www.llnl.gov/CASC/hypre/) on amd64. It works fine in 32 bits, but in 64, you have to verify LDFLAGS, in case of hypre, i have to modify Makefile to take "-m64" into account, and now, everything works fine (32 and 64)
    hth,
    gerard

  • Thread Pool Executor ( Runnable Class Executing another Runnable Class )

    Hi Folks,
    I have my main class called ThreadPoolExecutorUser. I have two Runnable classes called XYZ and ABC
    in ThreadPoolExecutorUser class I execute the Runnable class XYZ. Which inturn executes Runnable class ABC.
    The problem is that the Runnable class ABC is never executed ?. Can some one please explain what I am I doing wrong.
    _RB
    More Description Below :
    *public class ThreadPoolExecutorUser {*
    ThreadPoolExecutor dude = new ThreadPoolExecutor (.... );
    // I Execute the firest Runnable Xyz here
    dude.execute ( XYZ );
    Now I have two Runnable inner Classes
    *Class XYZ extends Runnable {*
    public void run () {
    s.o.p ( " I am in Xyz Runnable " );
    dude.execute ( ABC );
    *class ABC extends Runnable {*
    public void run () {
    s.o.p ( " I am in ABC Runnable " );
    }

    Hey folks.... Sorry its a typo in my e-mail. Sorry about that. I am pasting the actual code here.
    The problem again is that in the index function only FirstRunnable executes but not the SecondRunnable
    final public class Crawler {
        / create an instance of the ISSThreadPoolExecutor /
        private static ThreadPoolExecutor mythreadpoolexecutor = ThreadPoolExecutor.getInstance();
        / Constructor /
        / Index function /
        public void index( .... ) {
            :::::: code :::::::::
            // Execute this folder in a seperate thread.
            this.issthreadpoolexecutor.execute(new FirstRunnable(alpha, beta, gamma));
        / The Inner Class /
        class FirstRunnable implements Runnable {
            public FirstRunnable(int alpha, int beta, int gamma) {
            public void run() {
                            doSomething();
                            // Some other tasks and ...spawn of another thread.
                            issthreadpoolexecutor.execute(new SecondRunnable(a));
             // The Inner Class that Indexes the Folder
              class SecondRunnable implements Runnable {
                      private int ei;
                      public SecondRunnable ( int abc ) {
                            this.ei = abc;
                      public void run() {
                            doSomething ( ".....") ;
              } // End of SecondRunnable Class.
         } // End of FirstRunnable class.
    } // End of Crawler Class.

  • Upgrade jdk 1.6.0_15 or higher which class jar I need, I am running eclipse

    Can someone tell me, if I have a class 12.jar with jdk 1.2 and upgrade jdk to 1.6.0_15 or higher, which class jar I need and where can I get it? Ideal would be with some instructions. :) Thanks so much.

    It's all here: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

  • I'm trying to reinstall Logic Pro 9, and it says It's already installed. I have a project due for class and I need help asap. Please help!!!

    I'm trying to reinstall Logic Pro 9, and it says It's already installed. I have a project due for class and I need help asap. Please help!!!

    Yea I am. I deleted Logic Pro 9 and moved the App to the Trashcan like normal. Then when I go to install it, it says its already Installed. When I do this with other apps; it works fine, the install thing comes back up like it should once you have deleted the app

Maybe you are looking for