我试图找出哪个方法/循环在我的应用程序中给了Java . lang . out of memory error:Java堆空间。我对使用Eclipse Memory Analyzer分析java应用程序还很陌生。
在图像中,很明显调用JNI本地具有最大保留堆,但我们的应用程序中没有任何JNI调用。
请检查并确认内存泄漏是由调用任何本机代码(JNI Local)还是使用任何字符串迭代或其他原因引起的?
作为参考,我在这里附上总的概述和堆栈跟踪。hprof文件:
Accumulated Objects by Class
Label Number of Objects Used Heap Size Retained Heap Size
java.lang.String
First 10 of 15,252,128 objects 15,252,128 488,068,096 2,317,743,632
Thread Details
Thread WorkManager(2)-8
Thread Properties
Object / Stack Frame java.lang.Thread @ 0x69af09608
Name WorkManager(2)-8
Shallow Heap 112
Retained Heap 2,384,942,672
Context Class Loader org.jboss.util.loading.DelegatingClassLoader @ 0x6912bf868
Is Daemon true
Total: 6 entries
Thread Stack
WorkManager(2)-8
at java.lang.StringCoding.decode(Ljava/lang/String;[BII)[C (StringCoding.java:185)
at java.lang.String.<init>([BIILjava/lang/String;)V (String.java:451)
at java.lang.String.<init>([BLjava/lang/String;)V (String.java:523)
at java.io.UnixFileSystem.list(Ljava/io/File;)[Ljava/lang/String; (Native Method)
at java.io.File.list()[Ljava/lang/String; (File.java:990)
at java.io.File.listFiles(Ljava/io/FilenameFilter;)[Ljava/io/File; (File.java:1107)
at com.adobe.idp.dsc.service.file.impl.WatchedFolderUtils.resolveDuplicateFile(Ljava/lang/String;Z)Ljava/io/File; (WatchedFolderUtils.java:515)
at com.adobe.idp.dsc.provider.service.file.write.impl.FileResultHandlerImpl.resolveDestination(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)Ljava/io/File; (FileResultHandlerImpl.java:308)
at com.adobe.idp.dsc.provider.service.file.write.impl.FileResultHandlerImpl.preserveFiles(Lcom/adobe/idp/dsc/registry/infomodel/Endpoint;Ljava/lang/String;Ljava/lang/String;)V (FileResultHandlerImpl.java:817)
at com.adobe.idp.dsc.provider.service.file.write.impl.FileResultHandlerImpl.saveResults(Lcom/adobe/idp/dsc/InvocationResponse;Lcom/adobe/idp/dsc/registry/infomodel/Endpoint;Ljava/lang/String;Ljava/lang/String;)V (FileResultHandlerImpl.java:493)
at com.adobe.idp.dsc.provider.service.file.write.impl.FileResultHandlerImpl.handleSuccess(Ljava/lang/Object;Ljava/util/Map;)V (FileResultHandlerImpl.java:104)
at com.adobe.idp.dsc.provider.service.file.write.impl.FileResultHandlerImpl.handleSuccess(Lcom/adobe/idp/dsc/InvocationResponse;)V (FileResultHandlerImpl.java:73)
at sun.reflect.GeneratedMethodAccessor2229.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Method.java:616)
at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(Lcom/adobe/idp/dsc/InvocationRequest;)Lcom/adobe/idp/dsc/InvocationResponse; (DefaultPOJOInvokerImpl.java:118)
at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(Lcom/adobe/idp/dsc/component/ComponentContext;Lcom/adobe/idp/dsc/InvocationRequest;Lcom/adobe/idp/dsc/interceptor/RequestInterceptorChain;)Lcom/adobe/idp/dsc/InvocationResponse; (InvocationInterceptor.java:140)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(Lcom/adobe/idp/dsc/component/ComponentContext;Lcom/adobe/idp/dsc/InvocationRequest;)Lcom/adobe/idp/dsc/InvocationResponse; (RequestInterceptorChainImpl.java:60)
at com.adobe.idp.dsc.interceptor.impl.DocumentPassivationInterceptor.intercept(Lcom/adobe/idp/dsc/component/ComponentContext;Lcom/adobe/idp/dsc/InvocationRequest;Lcom/adobe/idp/dsc/interceptor/RequestInterceptorChain;)Lcom/adobe/idp/dsc/InvocationResponse; (DocumentPassivationInterceptor.java:53)
at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(Lcom/adobe/idp/dsc/component/ComponentContext;Lcom/adobe/idp/dsc/InvocationRequest;)Lcom/adobe/idp/dsc/InvocationResponse; (RequestInterceptorChainImpl.java:60)
at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(Lcom/adobe/idp/dsc/transaction/TransactionContext;)Ljava/lang/Object; (TransactionInterceptor.java:74)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.execute(Lcom/adobe/idp/dsc/transaction/TransactionContext;Lcom/adobe/idp/dsc/transaction/TransactionCallback;)Ljava/lang/Object; (EjbTransactionCMTAdapterBean.java:357)
at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterBean.doSupports(Lcom/adobe/idp/dsc/transaction/TransactionDefinition;Lcom/adobe/idp/dsc/transaction/TransactionCallback;)Ljava/lang/Object; (EjbTransactionCMTAdapterBean.java:227)
at sun.reflect.GeneratedMethodAccessor698.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (Method.java:616)
at org.jboss.invocation.Invocation.performCall(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; (Invocation.java:386)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (StatelessSessionContainer.java:233)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (CachedConnectionInterceptor.java:156)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (StatelessSessionInstanceInterceptor.java:173)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (CallValidationInterceptor.java:63)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(Lorg/jboss/invocation/Invocation;Z)Ljava/lang/Object; (AbstractTxInterceptor.java:121)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (TxInterceptorCMT.java:378)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.process(Lorg/jboss/invocation/Invocation;Z)Ljava/lang/Object; (SecurityInterceptor.java:228)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (SecurityInterceptor.java:211)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.process(Lorg/jboss/invocation/Invocation;Z)Ljava/lang/Object; (PreSecurityInterceptor.java:97)
at org.jboss.ejb.plugins.security.PreSecurityInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (PreSecurityInterceptor.java:81)
at org.jboss.ejb.plugins.LogInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (ProxyFactoryFinderInterceptor.java:138)
at org.jboss.ejb.SessionContainer.internalInvoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (SessionContainer.java:650)
at org.jboss.ejb.Container.invoke(Lorg/jboss/invocation/Invocation;)Ljava/lang/Object; (Container.java:1092)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; (BaseLocalProxyFactory.java:436)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; (StatelessSessionProxy.java:103)
at $Proxy289.doSupports(Lcom/adobe/idp/dsc/transaction/TransactionDefinition;Lcom/adobe/idp/dsc/transaction/TransactionCallback;)Ljava/lang/Object; (Unknown Source)
at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(Lcom/adobe/idp/dsc/transaction/TransactionDefinition;Lcom/adobe/idp/dsc/transaction/TransactionCallback;)Ljava/lang/Object; (EjbTransactionProvider.java:104)
您的堆栈跟踪显示了UnixFileSystem.list(文件)
方法,这是一个本机方法,它正在创建一个用于存储文件名的字符串数组。剩下的问题是为什么它要创建一个大小为1600万的数组。该方法从大小为 16
的数组开始,一旦目录扫描的迭代次数超过数组大小,该方法将加倍。因此,现在的迭代次数在800万到1600万之间。您要么在该目录中拥有难以置信的文件数量,要么在该本机代码中的循环终止条件中存在问题。
本文向大家介绍什么是OutOfMemoryError以及查找Java中OOM根本原因的步骤?,包括了什么是OutOfMemoryError以及查找Java中OOM根本原因的步骤?的使用技巧和注意事项,需要的朋友参考一下 该OutOfMemoryError异常 被抛出JVM,当JVM没有足够的可用内存,来分配。OutOfMemoryError 在Exception 类层次结构中属于E rror类别。
主要内容:前言,查询慢深层次原因揭秘:磁盘IO的过程,磁盘的顺序读写和随机读写,磁盘IO到底会有多慢呢?,用户查询请求慢的根本原因前言 接上一节,那么,一次查询的全过程是什么样的呢? 这个时候,我们通过各种百度和Google,然后加上自己的理解,终于搞明白了MySQL一次查询的全过程了。 首先,用户想要查询订单数据时,会先发送一个查询请求,如下图所示: 可以看到,当用户发送查询请求时,因为外卖订单项目是部署在Tomcat中的,Tomcat中的线程首先就会接收到用户的请求,然后把请求交给外卖订单项
问题内容: 我需要检查异常是否由某些数据库问题引起。我收到异常,并检查其原因是否包含“ ORA”字符串,然后将其返回(类似于“ ORA-00001”)。这里的问题是我收到的异常嵌套在其他异常中,因此,如果我不知道它是否是oracle异常,则必须检查该异常的原因,以此类推。有没有更清洁的方法可以做到这一点?有没有办法知道给定异常的第一个原因(嵌套的异常)? 我当前的代码如下所示: 问题答案: 只需遍
我在用grails跑步https://github.com/Netflix/ice但我只是无法让服务器运行,出现以下错误: |错误2014-06-06 14:52:55978[localhost-startStop-1]错误上下文。GrailsContextLoader-初始化应用程序时出错:com。谷歌。常见的util。同时发生的ExecutionError:java。lang.OutOfMem
错误:NoSuChelementException:没有这样的元素:无法定位元素:{“method”:“xpath”,“selector”:“//td[@class='c($PrimaryColor)W(51%)']”}(会话信息:chrome=77.0.3865.120) 我的代码如下: 这是我试图从“https://finance.yahoo.com/quote/goog?p=goog”中搜索
我们有一个使用eclipse-jetty版本8.1.6的java webserver。最近我们开始注意到内存不足的错误。我们对活动线程数的分析很少。这似乎在100左右是合理的。该进程具有5GB最大堆内存和4GB初始堆内存。 webserver平均每分钟接收350个请求。此外,我们在ELB(kubernetes服务)后面运行许多这样的实例。跑了几个小时后,我们注意到了这个OOM。这个问题是随机的,它