Open
Description
Hi,
we finally decided to update j2objc from very old version 2.8 to current master. During our profiling tests we realised, that after update, there is many memory leaks related to protobuffers. Because we are using protobuffers for inter device communication and we are sending relative big amount of data through them, this is major issue for us.
I went backwards through all changes in protobuf runtime, until I found change, that was implemented in commit 9e9614f . Specifically, the macro:
#define SINGULAR_SETTER_IMP(NAME) \
static void SingularSet##NAME(id msg, TYPE_##NAME value, size_t offset, CGPHasLocator hasLoc) { \
TYPE_##NAME *ptr = FIELD_PTR(TYPE_##NAME, msg, offset); \
ClearPreviousOneof(msg, hasLoc, (uintptr_t)ptr); \
TYPE_ASSIGN_##NAME(*ptr, value); \
SetHas(msg, hasLoc); \
}
that was changed in this commit to:
#define SINGULAR_SETTER_IMP(NAME) \
static void SingularSet##NAME(id msg, TYPE_##NAME value, size_t offset, CGPHasLocator hasLoc) { \
TYPE_##NAME *ptr = FIELD_PTR(TYPE_##NAME, msg, offset); \
ClearPreviousOneof(msg, hasLoc, (uintptr_t)ptr); \
TYPE_RETAINED_ASSIGN_##NAME(*ptr, value); \
SetHas(msg, hasLoc); \
}
seems to causing the memory leaks.
When I changed TYPE_RETAINED_ASSIGN
back to TYPE_ASSIGN
, memory leaks disappeared.
The screenshot from profiler:
Metadata
Metadata
Assignees
Labels
No labels