Re: memory debugging and C++ (program keeps crashing)
On Sun, Sep 29, 2002 at 02:01:38PM +1000, Brian May wrote:
> I suspect some sort of memory allocation error, but can't think
> of what would cause this problem. I was very careful not to free
> any memory still in use for instance (although I can't guarantee
> that there wasn't anything I missed).
Eventually, via trial and error I identified the problem.
I was doing:
List *list = [...orbit call...]
for (each item in list) {
Value &value = list[x];
save(&value);
}
free(list)
Or, put another way, I was saving a pointer to an item in the
list, then freeing the list.
There should be a malloc somewhere there. What was I thinking?
--
Brian May <bam@snoopy.apana.org.au>
Reply to: