Hi,

isn't there a garbage collecting done at the end to remove all the unused stuff 
to produce a binary that contains only the necessary parts ?

Regards.

----- Mail d'origine -----
De: Eric Raible <rai...@gmail.com>
À: tinycc-devel@nongnu.org
Envoyé: Thu, 29 Feb 2024 08:43:17 +0100 (CET)
Objet: [Tinycc-devel] Minimizing libtcc memory use

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


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to