Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8366425 | 11.0.30-oracle | Ivan Bereziuk | P3 | Resolved | Fixed | master |
Use placement new instead of memset() to avoid compiler warning/error when using GCC 8 with -Werror=class-memaccess (memset to initialize non-trivial object).
Fails in zForwardingTable.cpp:42:
memset(_table, ZForwardingTableEntry::empty(), _size * sizeof(ZForwardingTableEntry));
Note that this setup() function is a bit performance sensitive, so the memset() here likely performs much better than a for-loop with placement new. An alternative would be to turn ZForwardingTableEntry into a trivial object and continue using memset(), but that requires some more code restructuring.
Once could perhaps also argue that (Mmap|Malloc)ArrayAllocator should do the placement new loop, so that it always returns a properly constructed array.
Fails in zForwardingTable.cpp:42:
memset(_table, ZForwardingTableEntry::empty(), _size * sizeof(ZForwardingTableEntry));
Note that this setup() function is a bit performance sensitive, so the memset() here likely performs much better than a for-loop with placement new. An alternative would be to turn ZForwardingTableEntry into a trivial object and continue using memset(), but that requires some more code restructuring.
Once could perhaps also argue that (Mmap|Malloc)ArrayAllocator should do the placement new loop, so that it always returns a properly constructed array.
- backported by
-
JDK-8366425 ZGC: Don't use memset to initialize array of ZForwardingTableEntry
-
- Resolved
-
- relates to
-
JDK-8213153 Clean up GCC 8 errors
-
- Closed
-