You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The overloaded operator new and delete used in CBaseEntity have a second parameter used to pass the entvars_t instance to allow the engine to allocate memory for the entity. This is legal C++, but the syntax can cause problems. Clang-tidy complains about it and says destructors won't be called as a result.
Allocate the memory directly instead. This eliminates a call into the engine and allows dynamic memory allocation in the client as well without having to implement the engine function. This also ensures both overloads follow exactly the standard without requiring conditional compilation.
Note that the engine allocates the memory using calloc, so this will not reduce engine heap memory usage.
The text was updated successfully, but these errors were encountered:
The overloaded operator new and delete used in
CBaseEntity
have a second parameter used to pass theentvars_t
instance to allow the engine to allocate memory for the entity. This is legal C++, but the syntax can cause problems. Clang-tidy complains about it and says destructors won't be called as a result.Allocate the memory directly instead. This eliminates a call into the engine and allows dynamic memory allocation in the client as well without having to implement the engine function. This also ensures both overloads follow exactly the standard without requiring conditional compilation.
Note that the engine allocates the memory using
calloc
, so this will not reduce engine heap memory usage.The text was updated successfully, but these errors were encountered: