You might think that it is a coincidence that the topic of my question is similar to the name of the forum, but I really got it here by clicking on the term "stack overflow".
I am using an OPNET network simulator in which I program C. I think I am having a problem with large array sizes. It seems that I find some kind of memory allocation limitation. This may be related to OPNET, Windows, my laptop memory or, most likely, C language. The problem occurs when I try to use nested arrays with a total number of elements that reach several thousand integers. I think I have exceeded the overall memory allocation limit, and I wonder if there is a way to increase this cap. Here is the exact description of the problem:
I basically have a routing table. Let me call it routing_tbl [n], that is, I support 30 nodes (routers). Now for each node in this table, I save the information. about the many (hundreds) of available paths in an array called paths [p]. Again, for each path in this array, I save a list of nodes belonging to it in an array named hops [h]. Thus, I use at least nph integers, and the memory also contains other information. In the same function, I also use another nested array that consumes almost 40,000 integers. As soon as I run the simulation, it stops complaining about the stack overflow. It works when I reduce the overall size of the routing table. What do you think causes the problem and how can it be solved? Very grateful to Ali
c malloc memory stack-overflow
ali nezhad
source share