首页 文章 精选 留言 我的

精选列表

搜索[内存溢出],共10011篇文章
优秀的个人博客,低调大师

ambari server内存溢出

抛出的异常信息如下: java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383) at org.apache.hive.service.cli.thrift.TStatus.<clinit>(TStatus.java:136) at org.apache.hive.service.cli.thrift.TOpenSessionResp$TOpenSessionRespStandardScheme.read(TOpenSessionResp.java:626) at org.apache.hive.service.cli.thrift.TOpenSessionResp$TOpenSessionRespStandardScheme.read(TOpenSessionResp.java:612) at org.apache.hive.service.cli.thrift.TOpenSessionResp.read(TOpenSessionResp.java:520) at org.apache.hive.service.cli.thrift.TCLIService$OpenSession_result$OpenSession_resultStandardScheme.read(TCLIService.java:2281) at org.apache.hive.service.cli.thrift.TCLIService$OpenSession_result$OpenSession_resultStandardScheme.read(TCLIService.java:2266) at org.apache.hive.service.cli.thrift.TCLIService$OpenSession_result.read(TCLIService.java:2213) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156) at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143) at org.apache.ambari.view.hive.client.Connection$2.body(Connection.java:480) at org.apache.ambari.view.hive.client.Connection$2.body(Connection.java:475) at org.apache.ambari.view.hive.client.HiveCall.call(HiveCall.java:62) at org.apache.ambari.view.hive.client.Connection.openSession(Connection.java:475) at org.apache.ambari.view.hive.client.Connection.getOrCreateSessionByTag(Connection.java:517) at org.apache.ambari.view.hive.resources.browser.HiveBrowserService.databases(HiveBrowserService.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) 解决办法: 1. On the Ambari Server host, edit the ambari-env.sh file:vi /var/lib/ambari-server/ambari-env.sh2. For the AMBARI_JVM_ARGS variable, replace the default -Xmx2048m with thefollowing:-Xmx4096m -XX:PermSize=256m -XX:MaxPermSize=256m3. Restart Ambari Server for this change to take effect.ambari-server restart

优秀的个人博客,低调大师

Matisse预览图片黑屏,Glide内存溢出

项目中要到图片、视频选择的功能,然后google了一下,找到Matisse,知乎的图片选择框架,用的人还挺多的,果断依赖gradle,然后开始我的踩坑之旅。 首先,框架本身的图片框架glide是v3版本的,然后我项目中的是目前最新的v4.7.1,然后需要重写它的图片加载.imageEngine(new GlideEngine()),因为低版本的一些api在高版本已经找不到了,这都是小问题。 public class GlideEngine implements ImageEngine{ @Override public void loadThumbnail(Context context, int resize, Drawable placeholder, ImageView imageView, Uri uri) { Glide.with(context) .asBitmap() // some .jpeg files are actually gif .load(uri) .apply(new RequestOptions() .override(resize, resize) .placeholder(placeholder) .centerCrop()) .into(imageView); } @Override public void loadGifThumbnail(Context context, int resize, Drawable placeholder, ImageView imageView, Uri uri) { Glide.with(context) .asBitmap() // some .jpeg files are actually gif .load(uri) .apply(new RequestOptions() .override(resize, resize) .placeholder(placeholder) .centerCrop()) .into(imageView); } @Override public void loadImage(Context context, int resizeX, int resizeY, ImageView imageView, Uri uri) { Glide.with(context) .load(uri) .apply(new RequestOptions() .override(resizeX, resizeY) .priority(Priority.HIGH) .fitCenter()) .into(imageView); } @Override public void loadGifImage(Context context, int resizeX, int resizeY, ImageView imageView, Uri uri) { Glide.with(context) .asGif() .load(uri) .apply(new RequestOptions() .override(resizeX, resizeY) .priority(Priority.HIGH) .fitCenter()) .into(imageView); } @Override public boolean supportAnimatedGif() { return true; } } 然后运行成功,如愿以偿的打开了相册,当然这都建立了你已经申请并获得了6.0以上的运行期权限,Matisse图片加载器修改后,预览图片直接黑屏: Glide: Root cause (1 of 5) java.lang.OutOfMemoryError: Failed to allocate a 19660812 byte allocation with 13530040 free bytes and 12MB until OOM Glide: Root cause (4 of 5) java.io.IOException: java.lang.RuntimeException: setDataSource failed: status = 0x80000000 然后我下载了一份github上的代码,发现了Demo和GitHub上示例代码的问题。 Matisse.from(SampleActivity.this) .choose(MimeType.ofAll(), false) .countable(true) .capture(true) .captureStrategy( new CaptureStrategy(true, "com.zhihu.matisse.sample.fileprovider")) .maxSelectable(9) .addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K)) .gridExpectedSize( getResources().getDimensionPixelSize(R.dimen.grid_expected_size)) .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) .thumbnailScale(0.85f) // .imageEngine(new GlideEngine()) // for glide-V3 .imageEngine(new Glide4Engine()) // for glide-V4 .setOnSelectedListener(new OnSelectedListener() { @Override public void onSelected( @NonNull List<Uri> uriList, @NonNull List<String> pathList) { // DO SOMETHING IMMEDIATELY HERE Log.e("onSelected", "onSelected: pathList=" + pathList); } }) .originalEnable(true) .maxOriginalSize(10) .setOnCheckedListener(new OnCheckedListener() { @Override public void onCheck(boolean isChecked) { // DO SOMETHING IMMEDIATELY HERE Log.e("isChecked", "onCheck: isChecked=" + isChecked); } }) .forResult(REQUEST_CODE_CHOOSE); 在.addFilter(new GifSizeFilter())中GifSizeFilter这个类居然不是public的,在按照github上的示例代码时这行代码报错了,当时我以为是不太重要的代码,然后去掉了。 /* * Copyright 2017 Zhihu Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.zhihu.matisse.sample; import android.content.Context; import android.graphics.Point; import com.zhihu.matisse.MimeType; import com.zhihu.matisse.filter.Filter; import com.zhihu.matisse.internal.entity.IncapableCause; import com.zhihu.matisse.internal.entity.Item; import com.zhihu.matisse.internal.utils.PhotoMetadataUtils; import java.util.HashSet; import java.util.Set; class GifSizeFilter extends Filter { private int mMinWidth; private int mMinHeight; private int mMaxSize; GifSizeFilter(int minWidth, int minHeight, int maxSizeInBytes) { mMinWidth = minWidth; mMinHeight = minHeight; mMaxSize = maxSizeInBytes; } @Override public Set<MimeType> constraintTypes() { return new HashSet<MimeType>() {{ add(MimeType.GIF); }}; } @Override public IncapableCause filter(Context context, Item item) { if (!needFiltering(context, item)) return null; Point size = PhotoMetadataUtils.getBitmapBound(context.getContentResolver(), item.getContentUri()); if (size.x < mMinWidth || size.y < mMinHeight || item.size > mMaxSize) { return new IncapableCause(IncapableCause.DIALOG, context.getString(R.string.error_gif, mMinWidth, String.valueOf(PhotoMetadataUtils.getSizeInMB(mMaxSize)))); } return null; } } 最后的解决办法是复制了GifSizeFilter 并把它申明为public,问题解决。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册