aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rother <julian@jrother.eu>2022-03-13 20:28:19 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-03-13 20:40:48 +0100
commit793e22ecb7a8bf092ae0c2b46bfed9e039251ad8 (patch)
treef8bf33f7feb37946991f9c76784e0fe1a72229d8
parent47c5707d50f5b97e43e120159138e042fe3c5f71 (diff)
downloadmblaze-793e22ecb7a8bf092ae0c2b46bfed9e039251ad8.tar.gz
mblaze-793e22ecb7a8bf092ae0c2b46bfed9e039251ad8.tar.xz
mblaze-793e22ecb7a8bf092ae0c2b46bfed9e039251ad8.zip
mthread: reduce memory usage
mthread keeps header data of all messages in memory until it exits without ever using it. With this change it frees the header data of each message right after processing it. Closes: #222 [via git-merge-pr]
-rw-r--r--mthread.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/mthread.c b/mthread.c
index 9d718fc..d200879 100644
--- a/mthread.c
+++ b/mthread.c
@@ -29,7 +29,6 @@ static int optional;
struct container {
char *mid;
char *file;
- struct message *msg;
time_t date;
struct container *parent;
struct container *child;
@@ -87,7 +86,6 @@ midcont(char *mid)
exit(111);
c->mid = mid;
c->file = 0;
- c->msg = 0;
c->date = -1;
c->optional = 0;
c->parent = c->child = c->next = 0;
@@ -104,7 +102,6 @@ store_id(char *file, struct message *msg)
c = midcont(mid(msg));
c->file = strdup(file);
- c->msg = msg;
c->optional = optional;
return c;
@@ -239,6 +236,8 @@ out2:
c->child = 0;
}
}
+
+ blaze822_free(msg);
}
time_t
@@ -290,7 +289,6 @@ find_roots()
top = malloc(sizeof (struct container));
if (!top)
exit(111);
- top->msg = 0;
top->date = -1;
top->file = 0;
top->next = top->child = top->parent = 0;
@@ -315,7 +313,6 @@ prune_tree(struct container *c, int depth)
// turn into child if we don't exist and only have a child
c->mid = c->child->mid;
c->file = c->child->file;
- c->msg = c->child->msg;
if (c->child->date > c->date)
c->date = c->child->date;
c->optional = c->child->optional;