Progress towards v0.02 - Its all about the Stack

Post Reply
Gwa2100
Site Admin
Posts: 7
Joined: Tue Jan 29, 2019 3:41 am

Progress towards v0.02 - Its all about the Stack

Post by Gwa2100 » Fri Feb 01, 2019 6:32 am

So learned a hard lesson about stack vs heap. I thought I had a stronger understanding. I know about the sizes and limits, but I found out the hard way to pay attention to it. I was creating a large number of chickens on the stack and putting pointers to it on a vector for processing. Quickly surpassed the limits of the stack. Spent a good while trying to figure it out. Found that I forgot to add the = new () to the mix.

All good now.

Found a leak in the location memory system. Was storing the location of food and water every time it was seen. It did not check to see if it already knew of the location. Fixed.

Tried a test with 40, 50, 100, 1000, and 10000 chickens. Everything up to 100 worked like a charm. Need to work on some efficiencies to make it work better.

Good materials:
Stack vs Heap : https://www.gribblelab.org/CBootCamp/7_ ... _Heap.html

Post Reply