aboutsummaryrefslogtreecommitdiff
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/env.c b/src/env.c
index 10aa651..35b2ddf 100644
--- a/src/env.c
+++ b/src/env.c
@@ -5,7 +5,13 @@
#include "env.h"
#include "value.h"
-#define ENV_TABLE_CAP (1 << 8)
+#include "mempool.h"
+
+#define MEMPOOL_OBJ_TYPE struct symbol_table
+#define MEMPOOL_CAP 64
+MEMPOOL_GENERATE(env)
+
+#define ENV_TABLE_CAP (1 << 3)
static unsigned long str_hash(char *str)
{
@@ -34,7 +40,8 @@ static bool equal(void *key1, void *key2)
env_t env_create(env_t parent, env_destroy_func destroy_func)
{
- env_t env = malloc(sizeof(*env));
+ // env_t env = malloc(sizeof(*env));
+ env_t env = env_mempool_allocate();
env->destroy_func = destroy_func;
env->parent = parent;
env->refs = 1;
@@ -59,7 +66,8 @@ void env_destroy(env_t env)
}
hashtable_destroy(env->table);
- free(env);
+ // free(env);
+ env_mempool_free(env);
}
env_t env_copy(env_t env)