-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] <title>When I serialize this object, enough space is allocated, but it still throws a java.lang.OutOfMemoryError: Java heap space #1958
Comments
@a1342772 Could you provide a unit test, the code you provided is just a data class. |
BTW, If you do need to serialize |
Another thing is that how do we serializer |
@chaokunyang Oh, I see. How does Fury perform with arrays? I want to replace MemoryBuffer with arrays. |
What do you mean |
yes @chaokunyang |
@a1342772 I don't quite understand what you mean, could you provide more details what do you mean |
Compared to Protobuf, the speed of serialization and deserialization as well as the compression ratio. |
@a1342772 Fury supports zero-copy serialization of primitive array, there is no cost for serializing such objects, and of course no compression, the serialized size of array will be You could use zero-copy serialization by https://fury.apache.org/docs/guide/java_object_graph_guide#zero-copy-serialization: import org.apache.fury.*;
import org.apache.fury.config.*;
import org.apache.fury.serializer.BufferObject;
import org.apache.fury.memory.MemoryBuffer;
import java.util.*;
import java.util.stream.Collectors;
public class ZeroCopyExample {
// Note that fury instance should be reused instead of creation every time.
static Fury fury = Fury.builder()
.withLanguage(Language.JAVA)
.build();
// mvn exec:java -Dexec.mainClass="io.ray.fury.examples.ZeroCopyExample"
public static void main(String[] args) {
List<Object> list = Arrays.asList("str", new byte[1000], new int[100], new double[100]);
Collection<BufferObject> bufferObjects = new ArrayList<>();
byte[] bytes = fury.serialize(list, e -> !bufferObjects.add(e));
bufferObjects.
.forEach(buf -> buf.writeTo(...)).collect(Collectors.toList());
System.out.println(fury.deserialize(bytes, buffers));
}
} |
The text was updated successfully, but these errors were encountered: