Closed chakaz closed 1 year ago
Hi @danielaparker - just wondering if you also saw this behavior?
@chakaz - apologies for the late response. This hasn't come up before, possibly because many implementations of allocate
, like new
, provide maximally aligned storage. But we'll need to address this.
This should be addressed on master
Thanks @danielaparker!
Hi there! Our unit test show some runtime errors while using jsoncons with pmr:
Specifically such prints are printed by this line: https://github.com/dragonflydb/dragonfly/blob/3b0bd212f46f84e8eda3a02fe99de24f319c9725/src/core/json_test.cc#L127C1-L127C1
The prints are coming from here: https://github.com/danielaparker/jsoncons/blob/a414677d1333abd110e78c5eec950589956eee54/include/jsoncons/detail/heap_string.hpp#L134C1-L134C1
I think that the issue is actually within jsoncons rather than in our code, and the reason is that the allocation done internally in jsoncons is in byte (
byte_alloc.allocate(mem_size);
), while later we try to construct a struct in that memory (new(storage)heap_string_type(extra, byte_alloc);
), but it's not guaranteed to be aligned (and indeed in my setup it is not)