ThibaultLemaire/HomeworldSDL

Magic numbers when initializing ETG stack

ThibaultLemaire opened this issue · 0 comments

Where do these numbers come from ?

//amounts to allocate during parsing of an effect
#ifdef _X86_64
#define ETG_StartupParseSize        32768
#define ETG_EachFrameParseSize      32768
#else
#define ETG_StartupParseSize        16384
#define ETG_EachFrameParseSize      16384
#endif
#define ETG_TimeIndexParseSize      8192
#define ETG_VarTableParseLength     256
#define ETG_NewParticleLength       8
#define ETG_ConstDataPool 32768

It looks like the 64b definitions are twice that for 32b, but that seems too easy a calculation. Not every type doubles in size in the structs being allocated on the ETG stack. I bet aunxx didn't know how they were computed either when they ported the code to 64b, and just went for double the size.

Might be related to #2 but I doubt that's the problem. We'd have a segfault if the stack size was too little.