53清 发表于 2022-6-1 11:23:23

jdk1.8增大jvm内存,救救孩子吧

问题描述:
使用pyspark,显示堆空间不足的报错

但是我是用的pycharm无法利用eclipse修改jvm内存,因此想要修改文件中jvm的配置,但是一直报错显示失败,我该如何增大Jvm的内存呢?

Twilight6 发表于 2022-6-1 11:23:24

53清 发表于 2022-6-1 11:32
感谢,不过还是不行,还是会有那样的警告,然后代码显示堆空间不足,运行不动

在配置文件中加上这几行代码试试看:

-j9vm KNOWN
-hotspot IGNORE
-classic IGNORE
-native IGNORE
-green IGNORE

Twilight6 发表于 2022-6-1 11:28:51


这里不是报错吧,是警告

试试改成这样:

-Xms1024m
-Xmx2048m
-XX:PermSize=1024M
-XX:MaxPermSize=2048M

53清 发表于 2022-6-1 11:32:20

Twilight6 发表于 2022-6-1 11:28
这里不是报错吧,是警告

试试改成这样:

感谢,不过还是不行,还是会有那样的警告,然后代码显示堆空间不足,运行不动

御修 发表于 2022-6-1 11:50:59

这个是我改的你试一下
-Xms2048m
-Xmx2048m
-XX:ReservedCodeCacheSize=512m
-XX:+IgnoreUnrecognizedVMOptions
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
-Dsun.io.useCanonCaches=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Djdk.module.illegalAccess.silent=true
-Dkotlinx.coroutines.debug=off

53清 发表于 2022-6-1 12:01:31

Twilight6 发表于 2022-6-1 11:48
在配置文件中加上这几行代码试试看:

#
#
#
# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# List of JVMs that can be used as an option to java, javac, etc.
# Order is important -- first in this list is the default JVM.
# NOTE that this both this file and its format are UNSUPPORTED and
# WILL GO AWAY in a future release.
#
# You may also select a JVM in an arbitrary location with the
# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
# and may not be available in a future release.
#
-Xms1024m
-Xmx2048m
-XX:PermSize=1024M
-XX:MaxPermSize=2048M
-server KNOWN
-client IGNORE
-j9vm KNOWN
-hotspot IGNORE
-classic IGNORE
-native IGNORE
-green IGNORE






和之前一样,给我的感觉是设置的参数没有生效

53清 发表于 2022-6-1 12:02:42

53清 发表于 2022-6-1 12:01
和之前一样,给我的感觉是设置的参数没有生效

Warning: Missing VM type on line 37 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 38 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 39 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 40 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: No leading - on line 48 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 48 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: No leading - on line 49 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 49 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: No leading - on line 50 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 50 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: No leading - on line 51 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'
Warning: Missing VM type on line 51 of `D:\envir\jdk\jre\lib\amd64\jvm.cfg'

wuliangtdi 发表于 2022-6-1 13:54:19

试试这样
https://tu.eebk.com/item/6296fd9409475431297f9009.png
https://tu.eebk.com/item/6296feca094754312980e638.png
https://tu.eebk.com/item/6296fefb0947543129811c6d.png

53清 发表于 2022-6-28 23:51:14

最终的解决办法是改配置,不过还是感谢四楼大哥。
spark = SparkSession.builder \
    .master('local[*]') \
    .config("spark.driver.memory", "15g") \
    .appName('my-cool-app') \
    .getOrCreate()

sc = spark.sparkContext
sqlContext = SQLContext(sc)
改成15g就ok了

53清 发表于 2022-6-29 00:04:44

53清 发表于 2022-6-28 23:51
最终的解决办法是改配置,不过还是感谢四楼大哥。
spark = SparkSession.builder \
    .master('local[* ...

还有其它大佬们
页: [1]
查看完整版本: jdk1.8增大jvm内存,救救孩子吧