答案 0 :(得分:0)
Because you are using Java 1.7 (< than 8, which no longer uses PermGen space), you can set the maxPermSize, which I would bet helps you in this situation. Often, frameworks like Spring (using CGLib) and other scripting languages like Groovy make heavy use of dynamic class creation, which are stored in the PermGen space.
Try setting the maxPermSize like this and see if it helps:
public static <T, R> R transform(final T t, final Function<T, R> mapper, final R nullValue) {
return Optional.ofNullable(t).map(mapper).orElse(nullValue);
}
If you are in an IDE, you would want to set this as part of your VM Options.