tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Minimizing libtcc memory use


From: Eric Raible
Subject: [Tinycc-devel] Minimizing libtcc memory use
Date: Wed, 28 Feb 2024 23:43:17 -0800

In my use case I typically give libtcc code a few hundred lines of code:

1) some standard includes:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

2) ~100 lines of #defines 
3) ~50 lines of structs and typedefs
4) ~70 lines of function and data declarations (externs)
5) ~100 lines of actual code and data
6) The TCCState has ~50 symbols added with tcc_add_symbol().

All that is well and good, and it works perfectly.  The problem is that the
above uses roughly 30K bytes of memory.  But the actual code and data
looks to be between a few hundred and a few thousand bytes.  So a
50x reduction looks feasible.

I can envision a new API that would flush all unnecessary info.
For instance:  int tcc_finalize(TCCState *);
After such a call the only valid operation on the TCCState would be tcc_delete().

Two questions, if I may:
1) Is something like this of interest to anyone else?
2) Can anyone estimate how difficult this is?  I might be able to sponsor
development of such a feature if that would help.

Thanks - Eric


reply via email to

[Prev in Thread] Current Thread [Next in Thread]