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
Remove hunk memory system from server / replace Com_Error #155
Conversation
It was broken but now it isn't. |
src/engine/server/sv_init.cpp
Outdated
svs.snapshotEntities = ( entityState_t * ) Hunk_Alloc( sizeof( entityState_t ) * svs.numSnapshotEntities, ha_pref::h_high ); | ||
// allocate the snapshot entities | ||
free(svs.snapshotEntities); | ||
svs.snapshotEntities = static_cast<entityState_t*>(calloc(svs.numSnapshotEntities, sizeof(entityState_t))); |
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.
Please comment about the lifetime of the allocations.
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 lifetime was... it gets leaked when svs gets memset. I've changed it to use a unique_ptr and destroy svs instead of using memset.
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.
Just one more optional nit.
@@ -754,14 +754,14 @@ void CL_FlushMemory() | |||
if ( !com_sv_running->integer ) | |||
{ | |||
// clear the whole hunk | |||
Hunk_Clear(); | |||
Hunk_ShutDownRandomStuffAndClear(); |
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.
heh, maybe rename it to ShutdownSubsystems() or something and don't have it call Hunk_Clear()... idk, this seems like a weird construct anyways.
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'm hoping to do some more work on initialization and shutdown soon. In the meantime I like to give it a name that highlights the weirdness.
No description provided.