I have 5000+ strings pet-project for CLI and it can do some optional calculations and can output results to CLI or/and to file. Some new modules don't work.
Now I catch with GDB some strange segfaults and stack overflows, which I can't fix, though, I found all the places where the bugs are living. So, I see where and what's going wrong, but I have no idea how to fix it, because to fix it I have to spend a lot of time on learning some new tricky things in C - memory layouts and memory management.
I'm a novice to C and self-learning it as a hobby, so, to become familiar with memory management will take a long time, which I just don't have right now.
(I feel the need to learn some memory management golden rules, which can cover the whole program memory with nested calls, but I can't find points from which it's better to start)
Sorry, I can't fully describe in professional words what is going wrong in my program, but in general as I got it - it crushes because I don't know how to handle memory of structure copies properly, and how to manage memory safely in tricky(for me) hierarchy of function calls. I don't want to reduce amount of calls' levels cause of my intention to keep my code structure simple and readable.
I think that more experienced and well-educated in C people can fix my bugs just by editing my noobie designs in structure manipulations and memory management with advanced pointing technics, but.. I'm not that guy :(
So, my question is - What are the real cases, where it is impossible to fix the stack overflows and segmentation faults without changing the program design by separating its one exec to several smaller programs(execs) - control/interface module and functional modules?
In other words - What are the (memory management) cases, when you better to split your 1-process program to N-process program, than to redesign code structure to the loss of its readability?
I appreciate any practical or abstract examples, cause I try to figure out, if I'm in this kind of situation, or I'm not.
Now I have a choice - spend my time to understand really difficult to me part of CS - memory layouts and memory management, or spend my time on redesigning my code into multi-exec project.
I'm asking, cause I'm not sure, if the first direction will lead me to my actual goal.
I just want borders of using '1-exec-design' in C to be outlined a little.
Thanks for reading this.