下面的remove()方法导致“超过GC开销限制”。当将ABC中的协会从A、B或C中删除时,您能告诉我出了什么问题吗?注: ABC是A,B,C的映射表。
堆栈跟踪如下:Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded at java.util.jar.Attributes.read(Attributes.java:394) at java.util.jar.Manifest.read(Manifest.java:199) at java.util.jar.Manifest.<init>(Manifest.java:69) at java.util.jar.JarFile.getManifestFromReference(JarFile.java:185) at java.util.jar.JarFile.getManifest(JarFile.java:166) at java.net.URLClassLoader.defineClass(URLClassLoader.java:416) 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.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:171) at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:143) at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
@Resource()
@EqualsAndHashCode
class ABC {
static belongsTo =
[
a: A,
b: B,
c: C
]
def remove(){
this.a?.removeFromBC(this)
this.b?.removeFromAC(this)
this.c?.removeFromAB(this)
this.delete()
}
@Resource()
class C {
Collection<ABC> aB
static hasMany = [aB: ABC]
static constraints = {
aB cascade: "all-delete-orphan", nullable: true
}
}
@Resource()
class B {
Collection<ABC> aC
static hasMany = [aC: ABC]
static constraints = {
aC cascade: "all-delete-orphan", nullable: true
}
}
@Resource()
class A {
Collection<ABC> bC
static hasMany = [bC: ABC]
static constraints = {
bC cascade: "all-delete-orphan", nullable: true
}
}发布于 2016-02-04 17:31:13
不,该方法没有触发OOME,运行时分配的堆空间太少。增加服务器的内存。
https://stackoverflow.com/questions/35207084
复制相似问题