-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fixed memory leak on x86 android devices. #17172
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1291,7 +1291,9 @@ struct ALIGNAS(8) ColorAttachment { | |
LoadOp loadOp{LoadOp::CLEAR}; | ||
StoreOp storeOp{StoreOp::STORE}; | ||
GeneralBarrier *barrier{nullptr}; | ||
|
||
#if CC_CPU_ARCH == CC_CPU_ARCH_32 | ||
uint32_t _padding{0}; | ||
#endif | ||
EXPOSE_COPY_FN(ColorAttachment) | ||
}; | ||
|
||
|
@@ -1305,7 +1307,9 @@ struct ALIGNAS(8) DepthStencilAttachment { | |
LoadOp stencilLoadOp{LoadOp::CLEAR}; | ||
StoreOp stencilStoreOp{StoreOp::STORE}; | ||
GeneralBarrier *barrier{nullptr}; | ||
|
||
#if CC_CPU_ARCH == CC_CPU_ARCH_32 | ||
uint32_t _padding{0}; | ||
#endif | ||
EXPOSE_COPY_FN(DepthStencilAttachment) | ||
}; | ||
|
||
|
@@ -1396,7 +1400,7 @@ struct ALIGNAS(8) BufferBarrierInfo { | |
|
||
uint32_t offset{0}; | ||
uint32_t size{0}; | ||
|
||
uint32_t _padding{0}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot the padding changed member initialization order. It can be problematic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we depend on the order? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have searched the codebase and it seems aggregate initialization is not used. |
||
uint64_t discardContents{0}; // @ts-boolean | ||
|
||
Queue *srcQueue{nullptr}; // @ts-nullable | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can not use
std::has_unique_object_representations_v<T>
to check padding, as in the following codes, it also returns falseWill return false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could work for primitve types, and all gfx structs that need the added padding manually could work by
std:: has_unique_object_representations_v
So do we need to consider stl containers, like
string
,vector
,list
,map
in struct?And if so , any suggestion for how to check those types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example you wrote:
returns true.
You could paste code
in cpp.sh to test. The environment on
cpp.sh
is x86 .There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the usage. But as this function is defined in Macros.h, so should add comments to say that it only works for primitive types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, i was deceived by ChatGPT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add a comment later.