mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-22 07:20:05 +00:00
finally fixed this memory bug
we were accidentally tracking frees of stuff that was never allocated lol
This commit is contained in:
parent
5fc9af5564
commit
9c5270124d
@ -10,6 +10,7 @@
|
|||||||
// realloc wrapper
|
// realloc wrapper
|
||||||
void *cosmoM_reallocate(CState *state, void *buf, size_t oldSize, size_t newSize)
|
void *cosmoM_reallocate(CState *state, void *buf, size_t oldSize, size_t newSize)
|
||||||
{
|
{
|
||||||
|
if (buf == NULL) oldSize = 0;
|
||||||
#ifdef GC_DEBUG
|
#ifdef GC_DEBUG
|
||||||
printf("old allocated bytes: %ld\n", state->allocatedBytes);
|
printf("old allocated bytes: %ld\n", state->allocatedBytes);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -106,7 +106,6 @@ void cosmoV_freeState(CState *state)
|
|||||||
// free our gray stack & finally free the state structure
|
// free our gray stack & finally free the state structure
|
||||||
cosmoM_freearray(state, CObj *, state->grayStack.array, state->grayStack.capacity);
|
cosmoM_freearray(state, CObj *, state->grayStack.array, state->grayStack.capacity);
|
||||||
|
|
||||||
// TODO: yeah idk, it looks like im missing 688 bytes somewhere? i'll look into it later
|
|
||||||
#ifdef GC_DEBUG
|
#ifdef GC_DEBUG
|
||||||
if (state->allocatedBytes != 0) {
|
if (state->allocatedBytes != 0) {
|
||||||
printf("state->allocatedBytes doesn't match, got %lu\n", state->allocatedBytes);
|
printf("state->allocatedBytes doesn't match, got %lu\n", state->allocatedBytes);
|
||||||
|
Loading…
Reference in New Issue
Block a user