Skip to content

Memory leak fix on windows platform #21

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

Merged
merged 1 commit into from
Mar 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/mongoc/mongoc-counters.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ mongoc_counters_destroy (void)
bson_snprintf (name, sizeof name, "/mongoc-%u", pid);
shm_unlink (name);
}
#else
static void * mongoc_counters_memory = NULL;
static void
mongoc_counters_destroy (void)
{
bson_free(mongoc_counters_memory);
}
#endif


Expand Down Expand Up @@ -193,7 +200,9 @@ mongoc_counters_alloc (size_t size)
use_malloc:
#endif

return bson_malloc0(size);
mongoc_counters_memory = bson_malloc0(size);
atexit(mongoc_counters_destroy);
return mongoc_counters_memory;
}


Expand Down