VM memory usage with DOM objects

Hi - I have a general question regarding VM memory use (and garbage collection) when using instances of XMLDocument (we're using the Java version of the parser, v2.0.2.6).
Say we have an existing instance of XMLDocument containing a valid xml document. What happens when:
a) XMLDocument is set to null? When will all the previous xml Node/Element instances that were referenced in the document structure be garbage collected? My understanding is that objects will only be garbage collected when there are no remaining references to them. How does this apply to the tree structure of references between Node instances in the XML document? I am guessing that by setting XMLDocument to null, this change will eventually cascade through all the other nodes, so eventually they are released?
b) Secondly, what happens to the existing Node/Element instances referenced in an instance of XMLDocument if I assign it new document contents from getDocument() on an instance of DOMParser? Does this create a new document tree structure from scratch and create new instances of Nodes to represent the new document, or are the previous instances of Node etc from the previous document reused somehow?
c) Following on from above, if the previous instances of Node from the previous document are not reused, when are these garbage collected?
Thanks in advance,
Kevin Hooke

The XMLdocument object, although representing the entire document, is referenced solely to the root of the DOM tree. To clean up the DOM Tree, one should set all the references to the tree (doc, node, elements, ...) to null.
Here are the specic answers to your questions:
a) Setting XMLDocument to null will NOT have the cascading effect on the other Nodes/Elements.
b) Yes, the previous DOM Tree still exists if there are any Node/Elements pointing to it even if you get a new document. When you get a new document, you get a new DOM Tree representation.
c) Unfortunately, there is no way to guarantee when the garbage collection takes place in the JVM. Check out the method System.gc() to "suggest" to the JVM the invocation of the gabage collector.
Oracle XML Team

Similar Messages

  • Norton reports high memory usage with firefox and it crashes often

    Norton antivirus 2011 has pop up warnings reporting high memory usage from Firefox. I have been getting theem often and my computer is crashing often after those pop up warnings. Thanks

    Safe mode did not help.
    I have disabled ALL extensions and plug-ins, but the problem with "zig-zag" memory usage still remains (I've not tried to leave browser open for the night yet).
    I think I'll do clean reinstall with completely new empty profile (without sync'ed information) to try this out. If this works, I'll start adding stuff (configuration, sync, features, etc) to see what causes the problem.

  • Very high memory usage with Yahoo Mail

    After using Yahoo Mail for an hour or so my memory usage increases to a very high level.
    Just now, after reading and deleting about 50 e-mails (newsletters etc.) I noticed Firefox 17 running slowly and checked the memory usage in Windows Task Manager (I am using XP) and it was 1.2 Gb. My older laptop only has 2 Gb of RAM. Yahoo Mail was the only thing open at the time.
    I never notice this problem with Gmail which I mainly use. However I use Yahoo Mail for quite a few newsletters etc. that are less important and which I only check once a week or so.
    I found the following bug report about 3 years old which almost exactly describes my problem.
    https://bugzilla.mozilla.org/show_bug.cgi?id=506771
    But this report involves a much earlier Firefox version, and at the end it seems to say that the problem was fixed. However it well describes my current issue with Firefox 17, especially the continual increase in memory while using the up/down arrow keys to scroll through Yahoo e-mails.
    Is this normal to have to shut down and reopen Firefox every hour or so to clean out the memory? For some reason I only notice this when using Yahoo Mail. After using many other sites and having multiple tabs open for several hours I rarely reach that kind of memory usage. About the highest I've seen with other sites after a couple of hours is 600 Kb which is roughly when I start notice slower response times.

    See also:
    *https://support.mozilla.org/kb/firefox-uses-too-much-memory-ram
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Excessive memory usage with FireFox 3.6.8

    Is it normal for the total memory footprint of FireFox.exe and Plugin-Container.exe to be 1.14GB (488MB and 651MB respectively)?
    When first opening FireFox, it's footprint is approx 30MB, but inexorably creeps upward as I browse (typically YouTube/Hulu/4chan/GMail), consuming nearly 60% of total system memory before performance loss demands a browser restart.
    Is there any workaround or update/patch or command-line argument that will cap memory usage? Will rolling back to an earlier version of FF solve the problem, or is it a problem with Flash? Any advice would be appreciated.

    This is caused by the Flag Fox add-on, you can either disable or uninstall it.
    # Open the add-ons manager - in the menus select Tools, then Add-ons
    # In the add-ons manager go to the Extensions panel
    # In the list of add-ons click on Flag Fox to select it, then either click on the Disable or Uninstall button
    # Re-start Firefox to complete the process
    Do you have Personas Plus 1.6 installed? If you do try disabling that one instead, it has been causing problems with add-ons.

  • WinXP and Vista memory usage with Illustrator CS2 - is Vista winning?

    Dear forum.
    I have an AI-template file where I insert some very large PNG files into it, modifies the template a bit and then I print the the resulting document in PS-format. The PNG files may be as large as 100 MB (24-bits, approx. 100 mil. pixels in total). It appears that while a Vista-based machine has no problem loading one or even two copies of these huge files into memory, a WinXP-based machine can't even load a single file into memory. Instead, I a dialog box with the message: "Could not read the file because the plug-in could not understand this file". Is it really a faulty plug-in or is it just CS2's way of saying "not enough memory" in a quirky way?
    All in all, I would like to hear whether someone has the same experience with Vista, ie. it seems to be better at memory management or better at allocating memory for Illustrator CS2, enabling it to load large PNG files.
    The specifications of the WinXP-based machine:
    Pentium 4 2.6 GHz
    3 GB RAM
    Virtual memory 4095 MB in a physically separate drive from the OS disk
    All Visual Effects are turned off
    Has Illustrator CS2, Adobe Acrobat 7 and Distiller installed (and a few auxilliary programs)
    The specifications of the Vista-based machine:
    Dell OptiPlex 740SF
    AMD x2 5000 (2.6 GHHz)
    2 GB RAM (667 MHz, 2 x 1 GB)
    250 GB SATA disk
    Windows Vista
    Adobe Creative Suite 2 Standard + Adobe Creative Suite 3
    Thanks!

    Hi, everyone
         I got a new t440p 20ANA00UHH (8GB RAM, win8 64bits) about one week ago. It works really well, but its memory usage  confused me. In Task Manager, the "Performance" option shows memory is 68% (5.4G in use), but "Users" option shows memory usage 66% (1019.5M in use). Is that normal ? I just opened some websites and word files.

  • How to minimize memory usage with VM settings

    Using JDK 1.4.2, I am trying to minimize the memory usage of my application.
    Our GUI application consumes about ~20MB of heap space during normal operation, but it can easily grow to 50MB in some rare cases (Special feature accessed by user).
    We have to be able to run multiple instances (separate process/VMs) of this application on low end Windows PCs.
    The applications don't usually run for very long (less than 8 hours).
    Here is my problem.
    If I set the -Xms=20M -Xmx=64M, it works fine, but the GC is not very aggressive and soon, the application starts using a lot of memory, even if it is not really needed. And it never returns the memory to Windows OS.
    So each VM take more memory than really needed, which causes significant swapping on these low end PC (little RAM available).
    If I reduce the -Xmx flag, than I run out of memory in the rare cases where I need the full memory.
    Ideally, I would like to configure the GC to be more aggressive, i.e. the GC should collect instead of getting additional memory from the OS when possible.
    I read a few papers on Sun's web site about HotSpot tunning, but most of them are geared for large servers.
    Thanks!
    Francois

    And you are using the task manager to determine how "much" memory is being used correct?
    I suggest that you search out and read the numerous threads on this site that discuss that subject.

  • Memory Usage with new Tab Apps and Panoramas

    I actually don't have a problem, just a question. I love the new tab apps and panorama features in FF4, but I am wondering how the CPU usage compares with e earlier versions of FF. (I never checked and I'm not going to :)) Are there any recommendations on how tab apps and panoramas should be used? My assumption is that the "dormant" panos will use less cycles than if they were all open on the desktop, is this true?

    CS3 is still 32-bit so the user address space is 3.5GB. However, the OS can still use additional memory for cache to help performance, which comes into play when working with larger files. You need to download and install the enable VMBuffer plug-in, otherwise VMBuffering is disabled.
    See: http://www.crn.com/software/197700697
    Adobe forums:
    http://www.adobeforums.com/cgi-bin/webx?14@@.3bc45977/5
    some benchmarks:
    http://www.barefeats.com/octopro1.html
    http://www.barefeats.com/octopro4.html

  • Minimize memory usage with a multi-frame MovieClip

    I have a MovieClip in Flash with 100 frames. Each frame contains a certain icon I need to use in a project. I create instances of this icon MovieClip wherever I need an icon to appear, and gotoAndStop to a certain frame to display that icon.
    Will storing a 100 icons in a single movieclip cause every single icon to be created in memory whenever I create an instance of the MovieClip? If I stored each icon in the library and attached only the icon that is needed, would that consume less memory than creating this MovieClip that has all the icons in it?

    if you create an object in the ide (ie, by putting it on-stage), then it (roughly) only exists in memory while it is on-stage (or on the backstage).

  • Performance/Memory usage with WAD Templates in BIW

    Hi All,
    We have an E-Portal application on a CERT environment where a user can log in and see the templates created in WAD through internet.
    Most of the templates are stateful to facilitate export to Excel,XML and CSV along with saving of Graphs and charts.
    As the templates are stateful, they consume a lot of memory and under stress testing, application tanks when there are more than 15 simultaneous users as each user consumes approx 1 gb of memory.
    The response time also is very high.
    Is there any way to increase the performance without making the templates stateless?
    If no, is there any way we can get the required functionality by making the templates stateless?
    Regards,
    Godhuli

    Hi gaurav,
    I am not sure how I am using these commands. I am currently using a STATELESS connection. Take a look at the code below:
    <param name="OWNER" value="SAP_BW"/>
    <param name="CMD" value="SET_PROPERTIES"/>
    <param name="TEMPLATE_ID" value="ZADHOC_V1"/>
    <param name="PROPERTIES_ID"
    value="ZQ_WEB_LIBRARY_TEMP_PROPERTIES"/>
    <param name="STATELESS" value="X"/>
    <param name="DATA_MODE" value=""/>
    <param name="DEVICE_OPTIMIZATION" value=""/>
    <param name="NO_SESSION_COOKIE" value="X"/>
    <param name="MENU_CHARACTERISTIC_PROPERTIES" value="X"/>
    <param name="USE_PAGE_WRAPPER" value="X"/>
    <param name="CMENU_LABEL" value="Print"/>
    <param name="CMENU_FUNCTION" value="callPrintHelpService"/>
    My question is how can I emulate the same functionality of a STATELESS Connection i.e. break the connection from the application server once the query has run? I do not want to run the STATELESS Connection anymore.
    Also, could you show how/where to use the cmd=log_off&session_cmd=cancel code that you sent earlier.
    Thanks,
    Rahul

  • Interacting with DOM objects using HTML

    Hi,
    I want to listen to "text selection" on a webpage in AS (i.e. as soon as a user highlights some text and releases the mouse button, an event gets fired). Events for cut, copy, and paste are available, but none for "text selection". I have read about cross-scripting between AS and JavaScript and understand it, although I do not understand yet how it can solve my problem. Also, is there any simpler way to do it directly in AS, without getting into JavaScript?
    Thank you very much
    Rehan.

    There's a non-standard onselectstart attribute (or "selectstart" event type) that looks to be the only HTML DOM event dispatched for text selection.
    You can listen for such DOM events from ActionScript like so:
    package {
        import flash.display.Sprite;
        import flash.display.StageAlign;
        import flash.display.StageScaleMode;
        import flash.events.Event;
        import flash.html.HTMLLoader;
        public class HTMLLoadderTest extends Sprite
            private var html:HTMLLoader = new HTMLLoader();
            public function HTMLLoadderTest()
                this.stage.scaleMode = StageScaleMode.NO_SCALE;
                this.stage.align = StageAlign.TOP_LEFT;
                html.loadString("<html><body><p>Something to select.</p></body></html>");
                html.width = this.stage.stageWidth;
                html.height = this.stage.stageHeight;
                html.addEventListener(Event.COMPLETE, completeHandler);
                addChild(html);
                stage.nativeWindow.activate();
            private function completeHandler(event:Event):void {
                event.target.window.document.body.addEventListener("selectstart", reportSelection);
    //Note that you have to use Object as the parameter type because the JavaScript Event class is not the same as the ActionScript Event class
            private function reportSelection( event:Object ):void
                trace(html.window.getSelection());

  • Kernel memory usage

    Is there a way to see both the kernel virtual and the kernel real memory
    usage. I can see the real memory usage with "sar -k", or the "arena_size"
    in the "kmem_misc" kstat, or by looking at all the "kmem_cache" kstats
    like the crash "kmastat" command. But, can I find out how much is not
    "resident"?

    All of the kernel memory in use as reported by sar -k is resident and not paged (see kmem_alloc(9f)). That is why drivers must be careful how they use it.
    As for virtual address space, everything above the value of the kernelbase variable (see param.h)is kernel virtual address space.
    I think 0xE0000000 is the default for kernelbase on sun4d and Intel.
    Hope that helps. Regards,
    Ralph
    SUN DTS

  • Extensive (very very very extensive) memory usage of host application with CS extension

    Hi!
    I tried this only under Photoshop CS5 and InDesign CS5 under Windows 7.
    When you open and close CS extension panel, the memory taken by Photoshop (InDesign) increases by 6-30MB!
    In case of the simple HelloPhotoshop (HelloInDesign) panel from the examples, compiled in release mode, when you open it and close, - it's about 6-10MB each time you do it. And in case of a more complex panel, which uses AIR, etc. it's about 30MB per one panel close/open.
    When I use some panels in 5-10 minutes Photoshop (InDesign) increases its memory pool from 600MB up to 1,2 GB. And more. And this memory is never freed, only until Photoshop (InDesign) shutdown.
    I tried freeing all my arrays, killing display objects, etc. - nothing helped. Even a simple HelloPhotoshop (HelloInDesign) that does nothing eats memory.
    By the way, InDesign eats memory a lot faster .

    James, thank you for the very fast answer! I did various tests on the weekend on my computer and computer of my friend.
    And I can say, that Debug flag doesn't affect memory consumption.   They still eat memory. My steps to reproduce are as follows:
    (Windows 7 32 bit)
    Photoshop CS5:
    1) set HKEY_CURRENT_USER\Software\Adobe\CSXS2Preferences\PlayerDebugMode to 0
    2*) check HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\CSXS2Preferences (just in case)
    3) Compile HelloPhotoshop example to ZXP and install via  Extension manager
    4) restart computer
    5) Run Photoshop CS5 - Memory consumption: 100 096 KB
    6) Open HelloPhotoshop and close it 10 times
    7) Memory consumption: 155 840 - 5,574 MB per one close/open
    Maybe a garbage collector is expected to run and free this memory, but it never happened in my case. The memory pool was increasing to 1 GB when I was working with one of my panels - with no documents open in Photoshop
    In InDesign I tried the same thing with HelloInDesign ( I had to close the panel completely and then open with Window | Extensions | HelloInDesign)
    Memory consumption on start: 118 516
    Memory consumption after 10 open/close cycles: 197 516
    It's 7,9 MB per one close/open
    It's the simpliest panel test. When I'm using AIR libraries the memory usage is increasing a lot faster.

  • Ai CS4 & CS5: Can't move objects, huge memory usage. Tips?

    Okay guys this is my first post here, so bear with me.
    I'm just wondering if anyone can give guidance or refer me somewhere I can find a solution. I both CS4 and CS5 of Ai installed on my mac. Everything works just great, until I attempt to move an object. Something simple as a single line with freeze my system if I attempt to move it from one location to another.
    It is odd. I can scale/transform objects without any issue. Its just when I click an object to drag it to another location my system will freeze for about 5 seconds. The object won't move still. I opened up Activity Monitor and noticed my Memory usage sky rocketed as soon as I tried to move the object.
    Is there configurations for memory allocation in Illustrator like there is in photshop?
    (PS I have 3GB RAM and a 120GB HDD with 30GB free space, 2.0 Intel Core 2 processor, it's a 2007 Mac Mini)

    How big is the file? and is it complex if so then you simply do not have the resources. Also you might have a font cache issue.
    But I think the lack of resources.

  • Memory usage/freeze/crash modifying multiple objects

    I'm getting Labview hanging issues when I try to modify front panel objects while editing (not running).  It seems to be a general problem but this is the current scenario.  Many charts on my front panel (over thirty), so I multiple select, and RClick>Properties.  Watching Labview in Task Manager, I watch the Memory usage climb from about 90MB to 600MB.  And it takes a minute at least!  I can then change properties (plot scale ranges), and after more pausing, the dialog closes.  Soon after, I'll get a fatal error and LV crashes.  Something wrong here; I thought maybe it's my computer, but how can it take 0.5GB to load 30 chart property sets?  Core i5, LV2011, Win7.

    johnsold wrote:
    Do you have the chart history lengths set to large values (many MB)?  Do you have significant amounts of data saved as default in the charts?
    Try clearing the charts, one at a time if necessary, first.
    Charts have internal buffers. So LV may be trying to make backup copies so that you can undo if you change your mind.  Charts are generally not a good way to manage large amounts of data.  I use as a rule of thumb: Do not keeping more data in a chart than the number of pixels in its width.
    Lynn
    I aggree that crashing could be due to the amount of data in the charts. Try clearing them and saving the cleared chart as the default before doing the multiple object selection.
    I guess I live a more dangerous life-style that Lynn in that I'll allow more data points than pixels simply because LV is "SO DAMN GOOD" at rendering down the data and supporting zooming. "In the old days" it was a common technique to reduce the data sets presented to charts to avaoid killing the CPU. So Lynn's "rule of thumb" is consistent with history. modern CPU can handle the abuse much better now so I can get away with living close to the edge.
    Sharing thoughts,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Will passing object as parameter increase memory usage?

    Hi,
    Will passing an object as a parameter increase the mmory usage? will it affect the performance of the application any means. Please share your view.
    Regards,
    A.

    Ananth.durai wrote:
    Hi ,
    Just to precise my question, suppose i have an object called Student.I want to pass the Student Object to a method called addStudent().Now rather than passing Student Object, i am passing it's super class "Object". (i.e)
    addStudent(Object object) instead of addStudent(Student student)will it make any difference in performance?Those are declarations, not method passing. You'd still be passing the same thing, if it's just a question about how you declare the method.
    And it will make no difference in performance, except when you start getting bugs. You might start getting bugs because you declared the parameter with a more general type than is really necessary. If the method takes a Student, then declare it as taking a Student. Making it say it takes an Object will just make things worse.
    But as per Cogniac,
    when you pass a parameter or use an accessor function (get() function) or something of that sort, it's actually just passing a pointer that points to the memory location of the Object you want, not actually passing the Object itself to you, nor is it instantiating a new instance of the Object for your use.if i pass Object itself instead of Student,which memory address it will point out?That question makes no sense. You pass what you pass. If it's a Student object, then the reference the method gets will point to that object, regardless of whether the method knows that it's a Student or just an Object generally.

Maybe you are looking for

  • URGENT HELP:Reports Output in RTF Format

    Hi, I have a problem with Oracle Reports 3.0 I am generating a report output to a RTF file. The report is output in landscape orientation in Reports Runtime window. But when I open the RTF document, the output is in Portrait orientation and some of t

  • Mapping up poultry in  SAP

    Hi all,      I am implementing SAP to a poultry where we have various business process:   like procurement of chicks, growing them up and taking eggs for hatchery, etc.,  if any of u have implemented or worked on poultry can u plz help me out in defi

  • Final print size does not match screen view.

    Hi I am having problems getting my final prints to match the screen view.  Most recently I have had this problem:  I have an image that is sized to 5X7.  I have it on a 5X7 template in the print module of Lightroom.  The image dimensions in Lightroom

  • Slidelet causing imported SWF to advance

    Hi, I'm seeing some strange slidelet behavior. I have an imported SWF on the slide, consisting of 8 frames. On the same slide are 2 slidelets. When rolling OFF either slidelet the imported SWF advances 1 frame. The slidelets have their own screen rea

  • Running CRM_PRP_EXECUTE_RULES in background

    Hi all, When trying to run CRM_PRP_EXECUTE_RULES in the background, nothing happens. Basically, the problem is that I can only make a variant for the first screen where the PPR rules are to be selected. When you run the program in the foreground (als