Memory Leak - again...
Hello,
Given the code snipppet below, will it generate a memory leak?.
public class Dummy {
public static List getList( String key){
List dList;
dList = getAllDummyLists( key );
return dList;
//when this method exits, will dList be freed by GC?
}Thank you!
It depends on what getAllDummyLists does.
It's difficult to find memory leaks by visual inspection. If it were easy, it wouldn't be a problem.
If this is for work, the correct thing for you to do is to use a profiler.
Edited by: paulcw on Nov 14, 2007 7:54 PM
Similar Messages
-
Memory leak in JSpinner implementation (maybe others?)
Hi,
I am developing an application using Java and Swing, and have run into some problems with memory leaks. After examining the source code and making an example program (provided below), I can only come to the conclusion that there is a bug in the implementation of JSpinner in Sun Java 1.6.0_03.
If one uses a custom model with the JSpinner, it attaches itself as a listener to the model. However, it never removes the listening connection, even if the model is changed. This causes the JSpinner to be kept in memory as long as the model exists, even if all other references to the component have been removed.
An example program is available at http://eddie.dy.fi/~sampo/ModelTest.java . It is a simple swing program that has the JSpinner and two buttons, the first of which writes to stdout the listeners of the original model and the second changes the spinner model to a newly-created model. A sample output is below:
Running on 1.6.0_03 from Sun Microsystems Inc.
Listeners before connecting to JSpinner:
Model value is 0, 0 listeners connected:
Listeners after connecting to JSpinner:
Model value is 0, 2 listeners connected:
1: interface javax.swing.event.ChangeListener
2: javax.swing.JSpinner$ModelListener@9971ad
Listeners now:
Model value is 8, 2 listeners connected:
1: interface javax.swing.event.ChangeListener
2: javax.swing.JSpinner$ModelListener@9971ad
Changing spinner model.
Listeners now:
Model value is 8, 2 listeners connected:
1: interface javax.swing.event.ChangeListener
2: javax.swing.JSpinner$ModelListener@9971adThis shows that even though the model of the JSpinner has been changed, it still listens to the original model. I haven't looked at other components whether they retain connections to the old models as well.
In my case, I have an adaptor-model which provides a SpinnerModel interface to the actual data. The adaptor is implemented so that it listens to the underlying model only when it itself is being listened to. If the JComponents using the model were to remove the listening connections, it, too, would be automatically garbage-collected. However, since JSpinner does not remove the connections, the adaptor also continues to listen to the underlying model, and neither can be garbage-collected.
All in all, the listener-connections seem to be a very easy place to make memory leaks in Java and especially in Swing. However, as I see it, it would be a simple matter to make everything work automatically with one simple rule: Listen to the models only when necessary.
If a component is hidden (or alternatively has no contact to a parent JFrame or equivalent), it does not need to listen to the model and should remove the connections. When the component is again set visible (or connected to a frame) it can re-add the connections and re-read the current model values just as it does when initializing the component. Similarly, any adaptor-models should listen to the underlying model only when it itself is being listened to.
If the components were implemented in this way, one could simply remove a component from the frame and throw it away, and automatically any listener-connections will be removed and it can be garbage-collected. Similarly any adaptor-models are collected when they are no longer in use.
Changing the API implementation in this way would not require any changes to applications, as the only thing that changes are the listener-connections. Currently used separate connection-removing methods should still work, though they would be unnecessary any more. The API would look exactly the same from the view of an application programmer, only that she would not need to care about remnant listening connections. (As far as I can tell, the current API specification would allow the API to be implemented as described above, but it should of course require it to be implemented in such a way.)
Am I missing something, or is there some valid reason why the API is not implemented like this?
PS. I'm new to these forums, so if there is a better place to post these reports, please tell me. Thanks.Another cognition: It's the following code, that causes the memory to be accumulated:
obj = m_orb.resolve_initial_references("NameService");
ctx = NamingContextExtHelper.narrow(obj);For the first 4 calls to this code the memory usage of the nameservice is unchanged. From the 5th to the 8th call, it's increased by approx. 10KB per call. And thenceforward (beginning with the 9th call) it's increasing by approx. 10MB.
What's going wrong here? -
Hello, For the last couple of months, I am having issues with one of my tabs or the program itself causing a memory leak. I was hoping that subsequent releases would fix the problem, but when I downloaded V.11 it did not help.
I use tab mix plus and at any time, usually have about 25 tabs open. Everything functioned okay for 8 or so months up until recently.
I am wondering if there is a way to try to track down what is causing the leak. If it is one of my open pages, i will get rid of it. I tried opening one page at a time from scratch, but could not find the issue. .
I always have flash block enabled to cut down on the website junk.
using OSX firefox v11.Now, I'm not going to say it's an Add-On problem because from the research I've been doing on this problem for the last half hour shows that everyone has DIFFERENT add-ons, but everyone's having the SAME problem....
So I went through my add-ons and disabled them one by one, and the single add-on that has been giving me grief is the latest WOT add-on. So, I have Firefox 11 (so does my wife) and we both have the WOT add-on. But that's where the similarity ends... I have Windows 7 x64, she has Windows XP x86.... but she doesn't have the memory leak problem.
What I see is a sawtooth pattern over time. Memory goes up a little over 30+ seconds, then drops down. But over half an hour, the peaks of the sawtooth are larger, and it doesn't drop back down to the same level again - always a little more than before. And before you know it, FF is peaking at 1.5+GB, dropping down to 1.2GB... and FF is running very, very slowly.... excessive disk accesses (paging probably, though I apparently I still have 1.5 to 2.0 GB of free RAM). Killing FF frees it all up, and if I open FF again, it's back to using 250MB of RAM.
So, it's not the add-ons per se, but how they're interacting with FF (or the other way round).... most likely, it's this plug-in container they created to stop add-ons from taking FF with them when they crashed. Seems to have created more problems than it has solved..... would be great if you could choose not to use it.... -
Allocated memory pool was not deleted! 1 GB memory leak is too much for me!
Dear Sirs. I found that DB environment, that was configured to use 1 GB cache size, won't free it when closed! Why? First I tried to open and close environment and got the following:
Detected memory leaks!
Dumping objects ->
{596} normal block at 0x01970040, 1048596 bytes long.
Data: < > 14 00 10 00 DB DB DB DB 0B 00 10 00 01 00 00 00
{578} normal block at 0x00397978, 464 bytes long.
Data: < > D0 01 00 00 DB DB DB DB C7 01 00 00 01 00 00 00
Object dump complete.
I have and idea that BDB will reuse the memory, rite? OK, let's try to create the same environment and open it. After environment was opened, closed, opened again and again closed, I got the following:
Detected memory leaks!
Dumping objects ->
{3663} normal block at 0x01B80040, 1048596 bytes long.
Data: < > 14 00 10 00 DB DB DB DB 0B 00 10 00 01 00 00 00
{3645} normal block at 0x00396E60, 464 bytes long.
Data: < > D0 01 00 00 DB DB DB DB C7 01 00 00 01 00 00 00
{596} normal block at 0x01970040, 1048596 bytes long.
Data: < > 14 00 10 00 DB DB DB DB 0B 00 10 00 01 00 00 00
{578} normal block at 0x00397978, 464 bytes long.
Data: < > D0 01 00 00 DB DB DB DB C7 01 00 00 01 00 00 00
Object dump complete.
So memory was not reused, nor deallocated.
By the way, you may be interested in other leak I found, but fixed, see
Replication manager memory leak when setting local site information.
This leak is more serious, I am not sure I will fix it quickly. Maybe I'm doing something wrong? Could you please suggest something?
Thanks in advance!
With regards,
Vladislav.OK, the problem solved by fixing code in file 'log.c', method '__log_dbenv_refresh'.
Just added the code that deallocates memory of bulk buffer.
if (IS_ENV_REPLICATED(dbenv))
if (lp->bulk_buf != INVALID_ROFF)
__db_shalloc_free(&dblp->reginfo, lp->bulk_buf);
lp->bulk_buf = INVALID_ROFF;
lp->bulk_len = 0;
lp->bulk_off = 0;
It was allocated in the '__log_open' function, by the following code:
lp->ready_lsn = lp->lsn;
if (IS_ENV_REPLICATED(dbenv)) {
if ((ret = __db_shalloc(&dblp->reginfo, MEGABYTE, 0,
&bulk)) != 0)
goto err;
lp->bulk_buf = R_OFFSET(&dblp->reginfo, bulk);
lp->bulk_len = MEGABYTE;
lp->bulk_off = 0;
} else {
lp->bulk_buf = INVALID_ROFF;
lp->bulk_len = 0;
lp->bulk_off = 0;
Sorry for time taken to read my posts, I was really needy in quick help, but solved problems myself. -
My company has made the decision to do all of our internal inter-system communication using XML. Often we may need to transfer thousands of records from one system to another and due to this (and the 32K limit in prior versions) we're implementing it in 11g. Currently we have Oracle 11g Enterprise Edition Release 11.1.0.6.0 on 64 bit Linux.
This is a completely network/memory setup - the XML data comes in using UTL_HTTP and is stored in a CLOB in memory and then converted to a DOMDocument variable and finally the relevant data is extracted using xslprocessor.valueof calls.
While this is working fine for smaller datasets, I've discovered that repeated calls with very large documents cause the xslprocessor to run out of memory with the following message:
ERROR at line 1:
ORA-04030: out of process memory when trying to allocate 21256 bytes
(qmxdContextEnc,)
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 1010
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 1036
ORA-06512: at "XDB.DBMS_XSLPROCESSOR", line 1044
ORA-06512: at "SCOTT.UTL_INTERFACE_PKG", line 206
ORA-06512: at line 28
Elapsed: 00:03:32.45
SQL>
From further testing, it appears that the failure occurs after approximately 161,500 calls to xslprocessor.valueof however I'm sure this is dependent on the amount of server memory available (6 GB in my case).
I expect that we will try and log a TAR on this, but my DBA is on vacation right now. Has anyone else tried calling the xslprocessor 200,000 times in a single session?
I've tried to make my test code as simple as possible in order to track down the problem. This first block simply iterates through all of our offices asking for all of the employees at that office (there are 140 offices in the table).
DECLARE
CURSOR c_offices IS
SELECT office_id
FROM offices
ORDER BY office_id;
r_offices C_OFFICES%ROWTYPE;
BEGIN
OPEN c_offices;
LOOP
FETCH c_offices INTO r_offices;
EXIT WHEN c_offices%NOTFOUND;
utl_interface_pkg.get_employees(r_offices.office_id);
END LOOP;
CLOSE c_offices;
END;
Normally I'd be returning a collection of result data from this procedure, however I'm trying to make things as simple as possible and make sure I'm not causing the memory leak myself.
Below is what makes the SOAP calls (using the widely circulated UTL_SOAP_API) to get our data and then extracts the relevant parts. Each office (call) should return between 200 and 1200 employee records.
PROCEDURE get_employees (p_office_id IN VARCHAR2)
l_request utl_soap_api.t_request;
l_response utl_soap_api.t_response;
l_data_clob CLOB;
l_xml_namespace VARCHAR2(100) := 'xmlns="' || G_XMLNS_PREFIX || 'EMP.wsGetEmployees"';
l_xml_doc xmldom.DOMDocument;
l_node_list xmldom.DOMNodeList;
l_node xmldom.DOMNode;
parser xmlparser.Parser;
l_emp_id NUMBER;
l_emp_first_name VARCHAR2(100);
l_emp_last_name VARCHAR2(100);
BEGIN
--Set our authentication information.
utl_soap_api.set_proxy_authentication(p_username => G_AUTH_USER, p_password => G_AUTH_PASS);
l_request := utl_soap_api.new_request(p_method => 'wsGetEmployees',
p_namespace => l_xml_namespace);
utl_soap_api.add_parameter(p_request => l_request,
p_name => 'officeId',
p_type => 'xsd:string',
p_value => p_office_id);
l_response := utl_soap_api.invoke(p_request => l_request,
p_url => G_SOAP_URL,
p_action => 'wsGetEmployees');
dbms_lob.createtemporary(l_data_clob, cache=>FALSE);
l_data_clob := utl_soap_api.get_return_clob_value(p_response => l_response,
p_name => '*',
p_namespace => l_xml_namespace);
l_data_clob := DBMS_XMLGEN.CONVERT(l_data_clob, 1); --Storing in CLOB converted symbols (<">) into escaped values (<, &qt;, >). We need to CONVERT them back.
parser := xmlparser.newParser;
xmlparser.parseClob(parser, l_data_clob);
dbms_lob.freetemporary(l_data_clob);
l_xml_doc := xmlparser.getDocument(parser);
xmlparser.freeparser(parser);
l_node_list := xslprocessor.selectNodes(xmldom.makeNode(l_xml_doc),'/employees/employee');
FOR i_emp IN 0 .. (xmldom.getLength(l_node_list) - 1)
LOOP
l_node := xmldom.item(l_node_list, i_emp);
l_emp_id := dbms_xslprocessor.valueOf(l_node, 'EMPLOYEEID');
l_emp_first_name := dbms_xslprocessor.valueOf(l_node, 'FIRSTNAME');
l_emp_last_name := dbms_xslprocessor.valueOf(l_node, 'LASTNAME');
END LOOP;
xmldom.freeDocument(l_xml_doc);
END get_employees;
All of this works just fine for smaller result sets, or fewer iterations (only the first two or three offices). Even up to the point of failure the data is being extracted correctly - it just eventually runs out of memory. Is there any way to free up the xslprocessor? I've even tried issuing DBMS_SESSION.FREE_UNUSED_USER_MEMORY but it makes no difference.Replying to both of you -
Line 206 is the first call to xslprocessor.valueof:
LINE TEXT
206 l_emp_id := dbms_xslprocessor.valueOf(l_node, 'EMPLOYEEID');
This is one function inside of a larger package (the UTL_INTERFACE_PKG). The package is just a grouping of these functions - one for each type of SOAP interface we're using. None of the others exhibited this problem, but then none of them return anywhere near this much data either.
Here is the contents of V$TEMPORARY_LOBS immediately after the crash:
SID CACHE_LOBS NOCACHE_LOBS ABSTRACT_LOBS
132 0 0 0
148 19 1 0
SID 132 is a SYS session and SID 148 is mine.
I've discovered with further testing that if I comment out all of the xslprocessor.valueof calls except for the first one the code will complete successfully. It executes the valueof call 99,463 times. If I then uncomment one of those additional calls, we double the number of executions to a theoretical 198,926 (which is greater than the 161,500 point where it usually crashes) and it runs out of memory again. -
How Do I identify a Memory Leak?
I know this is not enought information but...
My application used 3 hashtables in a Data object to store application data. I retrive this data from an XML file. I also download XML and merge it into andother XML file. Some of these hashtables contain object that contain more hashtables.
I am trying to use JProbe Profiler to find the leak. I notice the memory increases when I load the data into objects and put them into hash tables. I also notice an increase when I am merging newly downloaded XML into the current XML data. I am useing Nodelists and NOdes to get the data.
Does anyone have any tips or suggestion on how to find a memory leak?
Thank you,
Al7 MB of XML file, loaded into a DOM? You realize, of
course, that DOMs are data structures that take up
memory, too, right?Yes I do. I load it into DOM then go through the Document and put the XML data into a custom file format (seialized objects). The data is sent from the server in the form of XML.
There's your problem. If you load X MB into memory
and keep it around as long as your application is
running, that's not necessarily a "leak". Yeah I realized this but it seems that if I load 7MB of my objects into hashtables my memory usage shouldn't increase by 30MB. I just assumed it would stay around 10MB.
The real issue is trading memory for CPU. If keeping
them in memory is crashing your app with OOM errors,
by all means just keep those objects in memory for as
long as you need them and then let the GC clean them
up. Don't put them in a Map, just let them have a
narrow method scope. Recreate them every time you
need them. Yes I'm beginning to see the light.
I'm sure you're thinking, "But recreating them will
cost CPU and slow down my app!" Yes, that's why it's
a tradeoff between memory and CPU.
Do you really need the whole document in memory at
once? If you're just cherry picking a few values out
of it, maybe you can use a SAX parser instead of a
DOM.
No I don't need all that data at once.
>
Either you're screwed or you need to rethink this.
You'd better hope that it's really not needed at
every moment for every client.After rethinking, I'm going to keep the serialized data in the file until I need it. Rather than searching through a hashtable for the object I want I will search the file.
What are your JVM settings for -Xms and -Xmx? Maybe
increasing those will do the trick.I did increase them and it helped a little, but I can still get a OutOfMemoryError if I try.
Are you sure these are the culprits? Have you
profiled the app to see if there are other sources of
leaks?Yes I have been profiling the application. It seems that there is a memory leek. I am just having trouble identifing it. I know the memory increases at 2 points. When I load the XML data into the DOM and when I load the DOM into my Custom object and then into the Hashtables.
Last resort? Buy more physical memory. It's cheap.I think I am going to keep unused data out of memory and access it form a file. After I make this change I think my memory usage will drop alot. I will profile again after I have this change made to see if there is a memory leak.
Thanks for you help,
Al -
How to configure license file for Memory Leak tool and WL Server 9.2?
(I posted to general JRockit forum before realizing existence of this forum which is probably more applicable.)
Here's our problem:
Running latest version of WL 9.2 MP3 and JRockit Mission Control 3.0.1
Able to run Mission Control, and connect to the WL Server and to run View Console with no problems.
I can't get Memory Leak tool to run because it complains about needing a license file.
First I tried with off the shelf WL 9.2 MP3.
Get error:
A license for Memory Leak Detector could not be found on the JRockit at (1.5) weblogic.Server (192).
Error: Can not find component Memory Leak Detector for JRockit * in the license file. Please check http://www.jrockit.com/license for license updates.
So I downloaded license file from JRockit download site - wls92.zip. It contains several files, but no clear instructions on what to do with these files. I copied one of these files "LIC-WLSP92.txt" to my JRockit home as C:\bea\JROCKI~1\jre\license.bea
Tried again. Restarted WL server. Restarted JRockit Mission Control.
Get error: A license for Memory Leak Detector could not be found on the JRockit at (1.5) weblogic.Server (3052).
The license file does not exist at: C:\bea\JROCKI~1\jre\license.bea
Any advise on how to install license or who to contact for help?Installed Mission Control 3.0.3.
Got following message when I attempted to run Memory Leak:
A license for Memory Leak Detector could not be found on the JRockit at (1.5) weblogic.Server (192).
Error: Can not find component Memory Leak Detector for JRockit * in the license file.
Please check http://www.jrockit.com/license for license updates.
I believe that we're using the latest downloads of WebLogic 9.2.x and JRockit.
WebLogic is running using 9.2.3 and JRockit build R27.4.0-90_CR358515-94243-1.5.0_12-20080118-1154-windows-ia2
Contents of C:\bea\jrockit_150_12\jre\license.bea:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bea-licenses>
<license-group format="1.0" product="JRockit" release="*">
</license-group>
</bea-licenses>
Could WebLogic be misconfigured?
Any diagnostics to help figure out the licensing?
Any other ideas? -
JBoss EAP 6 On JRockit - Memory Leak
hello team.
I have memory leak problem on jboss and jrockit.
My Environment :
1. OS :
CentOS release 6.4 (Final)
2. JRockit :
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Oracle JRockit(R) (build R28.2.7-7-155314-1.6.0_45-20130329-0641-linux-x86_64, compiled mode)
3. Application Server:
JBoss EAP 6.2.0.GA
4. Application
Large EJB Application (100 and more EJB Beans (Stateless, Stateful, MDB, Timers and so on)
Everything works fine on older application server versions (4.3 , 4.2)
But now I have Problem
Of course I know that problem is new version - and i have discussion on JBoss forums.
but guys I have question about jrockit with you:
What is the option "Other" in memory ??
[jboss@jboss-new bin]$ jrcmd 17114 print_memusage
17114:
Total mapped 8457864KB (reserved=2983100KB)
- Java heap 3145728KB (reserved=0KB)
- GC tables 105232KB
- Thread stacks 46412KB (#threads=138)
- Compiled code 1048576KB (used=12257KB)
- Internal 1480KB
- OS 170324KB
- Other 3639056KB
- Classblocks 10496KB (malloced=9631KB #28393)
- Java class data 289536KB (malloced=192391KB #133697 in 28393 classes)
- Native memory tracking 1024KB (malloced=294KB #10)
[jboss@jboss-new bin]$
This size increases every time - and took entire amount of RAM.
Thank in Advance.
Regards,
Paata LominadzeNot sure what the 'other' is, but it is probably best shown by using an example. By using displayMap we can display a memory map of various JVM subsystems and libraries that are loaded, including third-party libraries.
./jrcmd 4523 print_memusage displayMap
Total mapped 3984796KB (reserved=2978740KB)
- Java heap 524288KB (reserved=0KB)
- GC tables 17548KB
- Thread stacks 20276KB (#threads=39)
- Compiled code 1048576KB (used=14224KB)
- Internal 1672KB
- OS 146924KB
- Other 2092648KB
- Classblocks 7424KB (malloced=7381KB #20064)
- Java class data 124416KB (malloced=124411KB #91048 in 20064 classes)
- Native memory tracking 1024KB (malloced=118KB #10)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
OS *java r x 0x0000000000400000.( 76KB)
OS *java rw 0x0000000000612000.( 4KB)
OS *[heap] rw 0x00000000007c1000.( 132KB)
INT Poll r 0x000000007fffe000 ( 4KB)
INT Membar rw 0x000000007ffff000.( 4KB)
MSP Classblocks (1/2) rw 0x00000000df8c0000 ( 6912KB)
MSP Classblocks (2/2) rw 0x00000000dff80000 ( 512KB)
HEAP Java heap rw 0x00000000e0000000.( 524288KB)
OS *ld-2.12.so r x 0x0000003664400000.( 128KB)
OS *ld-2.12.so r 0x000000366461f000 ( 4KB)
OS *ld-2.12.so rw 0x0000003664620000 ( 4KB)
OS **ld-2.12.so rw 0x0000003664621000.( 4KB)
OS *gconv-modules.cache r 0x00007f8f2e4a0000 ( 28KB)
THREAD Stack 4630 rwx 0x00007f8f2e4a7000 ( 8KB)
THREAD Stack 4630 0x00007f8f2e4a9000 ( 12KB)
THREAD Stack 4630 rwx 0x00007f8f2e4ac000 ( 244KB)
MSP Java class data (5/37) rw 0x00007f8f2e4e9000 ( 14336KB)
MSP Java class data (9/37) rw 0x00007f8f2fa40000 ( 5888KB)
rw 0x00007f8f30000000 ( 188KB)
0x00007f8f3002f000 ( 65348KB)
rw 0x00007f8f34000000 ( 132KB)
0x00007f8f34021000 ( 65404KB)
rw 0x00007f8f38000000 ( 412KB)
0x00007f8f38067000.( 65124KB)
MSP Java class data (10/37) rw 0x00007f8f3c034000 ( 34048KB)
rw 0x00007f8f3e174000 ( 8200KB)
MSP Java class data (11/37) rw 0x00007f8f3e976000 ( 256KB)
OS *libhpi.so rw 0x00007f8fb37fc000 ( 8KB)
OS **libhpi.so rw 0x00007f8fb37fe000 ( 4KB)
CODE Compiled code rwx 0x00007f8fb37ff000 ( 64KB)
CODE Compiled code rwx 0x00007f8fb380f000 ( 128KB)
CODE Compiled code rwx 0x00007f8fb382f000 ( 64KB)
MSP Java class data (37/37) rw 0x00007f8ff83a1000 ( 512KB)
GC Modified Union Set (committed) rw 0x00007f8ff8421000 ( 132KB)
GC Card table rw 0x00007f8ff8442000 ( 1024KB)
GC Object bits (committed) rw 0x00007f8ff8542000 ( 8196KB)
Here
- thread is thread related (such as thread stacks)
- int, internal use (such as pointer pages)
- heap, chunk used by JRockit for the Java heap
- os, mapped directly from the operating system, such as third party DLLs or shared objects
- msp, memory space. a memory space is a native heap with a specific purpose, for example native memory allocation inside the JVM
- gc, garbage collection related, for example live bits
- code, compiled code
The 'other' memory space looks to me (from the blank entries in the above print-out) like they are a memory pages to are still not used. When the JVM starts it mappes an amount of memory. To my knowledge JRockit uses mmap (mmap(2) - Linux manual page), which creates a new mapping in the virtual address space. JRockit reserves an amount of memory (Java Heap (heap where your object instances go) + its own runtime (all the others)).
To see where the growth is in the various memory spaces, you can use 'print_memusage baseline', after which you can execute print_memusage again, for example,
./jrcmd 4523 print_memusage scale=M
4523:
Total mapped 3896MB +4MB (reserved=2905MB -3MB)
- Java heap 512MB (reserved=0MB)
- GC tables 17MB
- Thread stacks 19MB (#threads=39)
- Compiled code 1024MB (used=14MB +1MB)
- Internal 1MB
- OS 143MB
- Other 2043MB
- Classblocks 7MB (malloced=7MB #20596 +532)
- Java class data 126MB +4MB (malloced=125MB +4MB #93640 +2592 in 20596 classes)
- Native memory tracking 1MB (malloced=0MB #20 +10)
Note the additional column that prints out the difference in memory usage in relation to the baseline. You can also monitor native allocations by using trace_alloc_sites, memory allocations can then be displayed with different levels of detail using the level argument.
./jrcmd 4523 print_memusage trace_alloc_sites=true
4523:
Total mapped 3989660KB +4864KB (reserved=2974732KB -4008KB)
- Java heap 524288KB (reserved=0KB)
- GC tables 17548KB
- Thread stacks 20276KB (#threads=39)
- Compiled code 1048576KB (used=15265KB +1040KB)
- Internal 1672KB
- OS 146924KB
- Other 2092648KB
- Classblocks 7680KB +256KB (malloced=7669KB +287KB #20596 +532)
- Java class data 129024KB +4608KB (malloced=128967KB +4555KB #93640 +2592 in 20596 classes)
- Native memory tracking 1024KB (malloced=236KB +118KB #20 +10)
./jrcmd 4523 print_memusage level=3
4523:
Total mapped 3989660KB +4864KB (reserved=2974732KB -4008KB)
- Java heap 524288KB (reserved=0KB)
- GC tables 17548KB
- Thread stacks 20276KB (#threads=39)
- Compiled code 1048576KB (used=15265KB +1040KB)
- Internal 1672KB
- OS 146924KB
- Other 2092648KB
- Classblocks 7680KB +256KB (malloced=2KB -7379KB #4 -20060) Not fully traced
- Java class data 129024KB +4608KB (malloced=26KB -124385KB #16 -91032 in 20596 classes) Not fully traced.
- Native memory tracking 1024KB (malloced=118KB #10) Not fully traced.
gather_memorymap_database memtrace.c: 206 91KB +91KB (#1 +1)
gather_memory_usage osal_mspace.c:5142 7KB +7KB (#4 +4)
msGatherMSpacesUsageDatabase osal_mspace.c:6128 2KB +2KB (#1 +1)
msGatherMSpacesUsageDatabase osal_mspace.c:6134 16KB +16KB (#1 +1)
Note this is more on the JVM level, in your case in might be beneficial to investigate what is happening on the java heap. By using print_object_summary you can get insight how memory on the heap is used on a per-class basis. To get to the bottom of where the memory leak is you can use the memory-leak-detector (an example of its use can be found here Middleware Snippets: Fast, Faster, JRockit). You can also obtain a heapdump that can be analyzed by using for example MAT (see for an example here Middleware Snippets: Visualizing Class Loading). To obtain a heapdump you can run the command, for example,
[weblogic@machine1 bin]$ ./jrcmd 4523 runsystemgc full=true fullcompact=true
4523:
[weblogic@machine1 bin]$ ./jrcmd 4523 hprofdump filename=/home/weblogic/dump.hprof
4523:
Wrote dump to /home/weblogic/dump.hprof
Note that this first issues a full GC by using the runsystemgc command. -
HTTPService + XML Load + Memory Leak
Hi all....
I have noticed a memory leak in my application. This leak was
not apparent when the application was completed some months back
which is what left me a little confused as all I have done since
was upgrade to Flex 3 and possibly updated / changed my Flash
player.
I think I have found the cause to this problem (below) but am
not 100% sure that it is the "actual" problem or any reasons to
back my thoughts up, so have listed what I have checked / tried
along the way (maybe I have missed something)....
My Discovery Process:
I started profiling my application but did not find anything
out of the ordinary. I did a code walk-through double checking I
had cleaned up after myself, removing and even nulling all items
etc but still to now success - the leak is still there.
I have profiled the app in the profiler for reasonably long
periods of time.
All the classes etc being used within the app are consistent
in size and instance amount and there is no sign of any apparent
leak.
I am using a HTTPService that is loading XML data which I am
refreshing every 5 seconds. On this 5 second data refresh some
class instances are incremented but are restored to the expected
amount after a GC has occurred. The GC seems to take longer, the
longer the app is running, therefore more and more instances are
being added to the app, but when the GC eventually runs it "seems"
to clear these instances to the expected amount.
After scratching my head for a while I decided to make a copy
of my application, rip everything out, and focus in my data load,
where I found a problem!
I have now just a HTTPService that loads an XML file every 5
seconds, and this is all I currently have in the app (as I ripped
the rest of the code out), e.g:
Code:
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
....... creationComplete="initApp()" >
<mx:HTTPService
id="httpServiceResults"
url="
http://myIP:myPort/myRoot/myXML.cfm"
resultFormat="e4x"
result="httpResultHandler(event)" />
<script....... >
private var timerPulse:Timer;
private function initApp():void
httpServiceResults.send();
timerPulse = new Timer(5000, 0);
private function httpResultHandler(event:ResultEvent):void
timerPulse.start();
timerPulse.addEventListener(TimerEvent.TIMER, timerRefresh);
public function timerRefresh(eventObj:TimerEvent):void
timerPulse.stop();
timerPulse.removeEventListener(TimerEvent.TIMER,
timerRefresh);
timerPulse.reset();
httpServiceResults.send();
</script>
</mx:Application>
This is pretty much the code I am currently using and it
leaks.
I ran and monitored this in both the profiler and the
activity / task manager, and after running the app for 1800 seconds
(30 min) in the profiler, the memory size grew from 50mg to 165mg
just sending the HTTPService.
I tried loading the service in multiple ways including in AS
rather than MXML creating new instances of it each time, resetting
it, nulling it etc... but nothing prevented this memory increase.
I then tried to load the XML using different methods such as
using the URLRequest and URLLoader which again caused a memory
leak.
What still confuses me is that this leak did not exist in the
previous version and not a great deal has changed since then apart
from upgrading to Flex 3 and possibly upgrading my Flash payer
(which I believe is a possible cause)
After looking into this issue a bit more deeply, I read a few
blogs / forums and other people are experiencing the same problems
- even with a lot bigger leaks in some cases all when reloading
large sets of XML data into Flex - however, I as of yet found no
solution to this leak - people with a similar problem believe it is
not due to a memory leak more a GC error, and others pointing
towards the Flash Player itself that is leaking - I don't really
know.
Findings so far during investigation of this issue:
* App leaks for both HTTPService and ULRRequest / URLLoader
methods
* App only leaks when calling a data loader
* The size of the leak seems to depend on the size of the
XML being loaded
* The size of the leak also seems to be affected by the
applications heaviness - the greater seems to enhance the leak
An interesting factor I have noticed is that if I copy the
XML from my "myXML.cfm" that I link to in my HTTPService and copy
the contents of the file into my own XML file stored within the
Flex project root itself: ""myXML.xml"" the leak disappears... like
it seems to link when loading the XML over a network, however as my
network knowledge is not great I am not sure what to make of this -
any ideas???
Could the connection to the XML document cause leaks??? is
there anything else that could cause this leak??? have I something
in my code sample that could cause this leak??? or could any of the
other things I have mentioed cause this leak???
Any help / ideas would be greatly appreciated.
Thanks,
Jon.I also observed heavy memory leak from using httpservice with
XML data. I am using Flex3 builder under Linux. My Flex application
polls httpservice every 10 seconds. The reply is a short XML
message less than 100 bytes. This simple polling will consume 30+
MB of memory every hour. I leave it idling for several hours and it
took 200 MB of memory. No sign of garbage collection at all. -
Seems to be a memory leak in itunes 10.6.3.25
I cant seem to find a usefull end-user bug reporting system; so i just post it here: had to redownload all my songs (lots of them); after a few 100 iTunes displayed a message saying something cryptic like that there was not enough memory to save the library or so; little later iTunes completely hung; checked in task manager... about 1GB of memory usage. Just restarted downloading the rest of my music, memory usage is already over 200MB again... think you guys have a memory leak in your downloading or caching code.
Close your iTunes,
Go to command Prompt -
(Win 7/Vista) - START/ALL PROGRAMS/ACCESSORIES, right mouse click "Command Prompt", choose "Run as Administrator".
(Win XP SP2 n above) - START/ALL PROGRAMS/ACCESSORIES/Command Prompt
In the "Command Prompt" screen, type in
netsh winsock reset
Hit "ENTER" key
Restart your computer.
If you do get a prompt after restart windows to remap LSP, just click NO.
Now launch your iTunes and see if it is working normal now.
If you are still having these type of problems after trying the winsock reset, refer to this article to identify which software in your system is inserting LSP:
Apple software on Windows: May see performance issues and blank iTunes Store
http://support.apple.com/kb/TS4123?viewlocale=en_US -
Memory Leak in Report after upgrading from Crystal Reports 10.5 to 13.0.1/2
I'm currently having an issue with crystal reports 13 (Visual Studio 2010), We have recently updated our CRM Solution to use the newer crystal reports runtime as we are now using Visual Studio 2010,
We have a client who has a report which contains a sub report which basically contains a Image pulled from a MSSQL Database as a BLOB Image Field which is basically scanned images relating to the report, Previously the report worked fine before the Client Updated our CRM Solution to the latest version, Now for each individual page which has the scanned image the application is swallowing 100 MB of ram, as there are around 32 of these scanned images and our solution is a 32 bit application we are getting out of memory errors due to the whole 2GB addressable to a 32 bit process limitation,
The images are around 4MP and stored in JPG format in the database so should not be consuming over 100mb of ram per image displayed by the report even if they are being stored uncompressed in RGBA Format,
Likewise when viewing the pages of the report manually after a specific page (when the amount of memory addressable by a 32 bit application gets hit) the images just don't display and then any pages with the image are not being displayed and not giving an error / exception.
I have tried re-saving the .rpt files to cause them to be in the newer crystal reports format and this is still happening, likewise I have tried un-installing the 13.0.1 and installing the 13.0.2 runtime.
I am just about to check SQL which pulls the image for the sub report, although I am sure for each sub report it should only be pulling one row with one jpeg image in case the sub report is holding quite a few images but only displaying the first.
Likewise If all else fails I will try re-creating the report as I have experienced issues with some other specific reports doing strange things after being updated from the 2008 runtime which I really am not liking the idea of due to how fiddly crystal reports can be, It is good and does the job but takes far longer than some other solutions to get what you are trying to achieve done.
This report had been working fine for 2+ years before the client updated to the most recent version of our CRM Software.
Has anyone else experienced simular issues with the latest runtime.I have just been reviewing the code for this and it appears that the sub report is pulling all of the images,
It is strange that previously this was working fine seems like the newer runtime does not dispose of the data once it has been displayed on a sub report which would explain memory leak as it will call the select again pulling approx 60 images which are probably approx 8 - 900KB plus sub report + uncompressed image to display and then filtering.
I am about to modify this report and will post if fix i put in place resolves the issue. -
Memory leak in Flash with Win7, IE9, 64bit
I have been having an issue for quite some time on 2 different computers. Both of them are Windows 7 64bit and use IE9.
Generally I have 1 - 5 tabs open in IE at any given time. Usually one of them is a tab for Yahoo Mail. Other tabs are related to whatever I may be searching for or doing at that time, so pretty varied. Throughout the day at random times I will begin to get a grey icon for anywhere on some tabs where there is supposed to be a flash video (like the ad in the right side of the Yahoo Mail tab)... When it happens I can open Task Manager in windows and I notice that 1 or two "iexplore.exe *32" processes have memory consumed in excess of 600,000K. When I end those processes I am again able to see any flash videos that need to be viewed.
If I leave Task Manager open throughout the day I can see the memory consumption increase on various tabs until I cannot see any more flash videos or even open new tabs in IE until I end those processes. Further, the memory does not get released if I just close the tabs in IE, but I must either end the specific process or close all tabs in IE so that IE is completely unloaded.
I have since uninstalled the Flash player and the issue has gone away. I can re-install the flash player and the issue returns. Can you please help? This has been a huge annoyance and I had hoped that it would be fixed sooner or later. Unfortunately it has not been fixed and has finally prompted me to post something....First, I just wanted to follow up on this thread and let you guys know that we'll continue to look into it. I also want to clarify some player behavior, and provide tips for helping to identify a defect that we can take action on.
Whenever you refresh/reload a tab, the browser should signal to us that our process is being destroyed, at which point we would release all of our resources and shut down. SergeStone's comment above makes it sound like this might not be happening in a particular case. I'm going to build out a few tests this week to explore this in more detail, and I'll follow up with results.
Also, it's worth discussing the difference between memory consumption and memory leaks. Flash Player is designed to consume a percentage of your available memory. If you have a 32-bit machine with 2GB of RAM, we're going to consume a lot less memory than a 64-bit system with 16GB of RAM.
Not all Flash content is authored well. If the ActionScript developer is continuously loading objects into their SWF and never releasing them (a slide-show is a good simplistic example), you'll see a steady usage increase as each new object loads in. You should also see that evenutally, our automatic Garbage Collection process will kick in. Memory will peak out, and then you'll see a short CPU spike as we look at all of the available objects and cull as many unused ones as possible, consumed memory will dip down significantly (as long as we can cull stuff), and then start growing again until the next time GC kicks in. We tend to do this judiciously, as poorly-timed GC can cause games to stutter if it happens when lots of things are moving around on the display and you don't have a lot of available CPU.
If it's our bug, it should be straightforward to fix, and I can follow up to this thread with a beta build for you guys to evaluate once we have one available. In the meantime, it would be interesting to know if you're seeing the problem on our current Beta builds (which is where we would do the work).
Here's a link to the latest Beta download:
http://labs.adobe.com/downloads/flashplayer11-5.html
Also, the simplest example is the most actionable. If you can find a situation where a site in a single tab reproduces the problem, that's a quick and easy thing to deal with. If the repro case involves opening seven tabs and waiting six hours, someone needs to repeat that over and over, until they can isolate what content experiences the problem and then iterate a bunch more with a debugger attached to try and isolate the root cause. The more complicated the content, the more difficult that is.
Secondly, I wanted to offer some actionable suggestions that you could use now to work around this issue.
Try Firefox or Chrome. Both of these browsers run Flash Player as a separate process.
For those of you using Performance Monitor and other tools to measure, you can directly observe the resources used by Flash Player
For the folks concerned about Bookmarks synchronization, both Firefox and Chrome provide native bookmark syncing and import from IE mechanisms.
Xmarks is a really nice, free utility that provides cross-browser, cross-platform bookmark synchronization.
Thanks,
Jeromie Clark -
Memory leak in LoadVars?
Hi,
In one of our apps, we've a need to continuously load new
data (using Loadvars) every x seconds from the server. However, I
seem to be having a memory leak issue when doing the same. Consider
the following skeletal code:
var myVars:LoadVars = new LoadVars();
myVars.onHTTPStatus = function(httpStatus) {
this.httpStatus = httpStatus;
myVars.onLoad = function(success:Boolean){
//trace("Data loaded: " + success);
var int:Number = setInterval(loadData,2000);
function loadData(){
myVars.load("
http://server/RealTime/ISv3.asp?UpperLimit=100&lowerLimit=0");
stop();
Here, I'm loading the data from an ASP page every 2 seconds
in the same LoadVars object. Now, when I run this movie continuosly
for a few hours, there's a huge increase in memory usage of this
movie. Using the profiler, I've made sure that the memory is
increasing for the Flash movie and not InetInfo or any other
process/thread.
Now, here we do not have anything else in the movie (no
visuals, no calculations etc.) and more over we're re-using the
same LoadVars object to reload data. Any pointers as to what we
could be doing wrong? Any help would be greatly appreciated.You might try setting it up with two LoadVars and using
sendAndLoad. And
also you have no guarantee your call has finished before your
trying again.
You could use a simple boolean to only call the asp after the
prior call has
finished.
var mySender:LoadVars = new LoadVars();
var myReceiver:LoadVars = new LoadVars();
var doneLoading = true;
mySender.onHTTPStatus = function(httpStatus) {
this.httpStatus = httpStatus;
myReceiver.onLoad = function(success:Boolean){
doneLoading = true;
//trace("Data loaded: " + success);
function loadData(){
if(doneLoading){
doneLoading = false;
mySender.upperLimit = 100;
mySender.lowerLimit = 0;
mySender.sendAndLoad("
http://server/RealTime/ISv3.asp",
myReceiver);
var int:Number = setInterval(loadData, 2000);
stop();
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Does the 3dpc line plot have a memory leak? (ver 8.6.1)
I have a very large application with a very small memory leak and the 3dpc line plot appears to be the most likely candidate.
I create a line plot of data (100-200 points of XYZ) pass this to a Create 3dpc_surfaceplot:xctlcreate.vi in a loop (updated at a few hz).
This code appears to grow in memory slowly over time (not at a regular pace sometimes a garbage collector must kick in). Is this possible, is there anything I have to do to use this function in a loop, there is no help file provided for this vi.
Can I avoide this situation (I am having trouble replicating te out of memory my client is seeing but again this is the most likely cause)?
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGAHi Paul,
Thank you for bring this to our attention. Do you have a small piece of code that exhibits this memory leak? If so, can you please it so that I can try to reproduce the issue here? If I can, then I can report the issue to R&D for further investigation.
Aaron P
National Instruments
Applications Engineer
http://www.ni.com/support -
Memory Leak in Input Subsystem 10.3.2.798
See screenshot. After reboot it drops back down to about 50-60MB but after a while it starts climbing again. This is happening on my Classic with 10.3.2.798.
I have 3 languages enabled on mine, English QWERTY, Chinese Handwriting and Chinese Pinyin and switch between them, mostly in the Browser.
http://imgur.com/cdYzu5bUpdate: The input peaked at 499.3MB yesterday. The memory leak seems to occur when I use ALT+ENTER to switch input methods. System displays the list of input types, but at the same time sends a "Submit" to the underlying text field and address bar and the search starts with no text, with the input menu still displayed. Then at that point it starts to leak memory. Please look into this. I had my device rebooted countless times within a week and never had this before 10.3.2.
Maybe you are looking for
-
How can I send a group email like to "family"?
I would like to create a group for my family and one for my classmates, so that I may hit one button and send out a mass email to that group. How do I do that? Regina
-
Restarting App server and Process Scheduler
Hi all, Can any body send me the document on how to Restart App server and Process Scheduler. Thanks In Advance Karthik
-
I am working on an application. Every time a user (User A) submits an article or a message, the Greenwich time of the submission is stored in the database no matter which the time zone the user (User A) is. Another user (User B who may be in another
-
IMPORTANT-PLEASE REPLY ASAP How to remove old mess...
Hi, I Would Like To Remove A Ton Of Old Messages, So Neither Person Can See Them, And Theres No Option To Remove Or Edit, Its To My Skype Friend w[***] is skype name, if u could, remove everything in messaging from before nov 6th 2012, HURRY pls im b
-
Hi there, I need to enhance the Migo_gr transaction, a new tabpage in the header has te be included. Badi MB_MIGO_BADI calls my own defined screen with some input fields. When I activite I see my new screen. So far, so good. The problem: The new tabp