Skip to content
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

Merged
merged 4 commits into from Jan 29, 2019

Conversation

slipher
Copy link
Member

@slipher slipher commented Jan 26, 2019

No description provided.

@slipher
Copy link
Member Author

slipher commented Jan 27, 2019

It was broken but now it isn't.

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)));
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

@DolceTriade DolceTriade left a 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();
Copy link
Contributor

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.

Copy link
Member Author

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.

@slipher slipher merged commit f1ffca9 into DaemonEngine:master Jan 29, 2019
@slipher slipher deleted the serverhunk branch January 29, 2019 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants