My program needs to load many big wordlist files, so it always takes a long time to start up.
it’s so inefficient to recover quickly in crash. I have a raw idea, but I am not sure if it’s feasible. Is it possible to load the files into shared memory and just attach to it when starting up?
Could you give me some ideas or suggestions? Is there any valuable instance?
It’s definitely possible, provided you design a format which supports
static initialization, or is just raw data. There are two
possibilities: if you can design a raw data format (nothing but PODS,
and no pointers); and if portability isn’t a concern, including accross
different versions of the compiler (you provide the file as part of your
executable package), then you can normally just
mmapthe file.Otherwise (what I’ve usually done), you can write a small program which
will convert your data into C++ definitions (again, only PODs) with
initializers (static), compile it, and link it in, either as a DLL or
statically.