[NTLUG:Discuss] Stack size or malloc problem
Greg Edwards
greg at nas-inet.com
Wed Jul 14 09:29:43 CDT 2004
Ralph Green, Jr wrote:
> Howdy,
> I have been having a lot of problems with a program I am working on
> that uses the MySQL database. It is a C program and itdoes many
> thousands of database updates. I start having odd little problems that
> look to me like either 1)insufficient stack space, or 2) malloc and free
> problems. I know my mallocs and free are right, but I don't know about
> MySQLs.
> Ralph
>
Sounds like a corrupted stack rather than a stack overflow. Make very
sure that all of your local vars have been initialized before sending to
a func. I know that sounds like a no brainer, but it's one of the most
common causes for something like this.
Unless you are really going deep into some recursive function or passing
a ton of pass by value structs its hard to blow the stack.
I've attached a function you can plug into your code to watch the memory
on a given process. You'll have to modify it to fit your needs, of course.
--
Greg Edwards
Software Engineering Services - http://consult.nas-inet.com
Custom Hosted Websites - http://www.nas-inet.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nasi_proglist.c
Url: http://ntlug.org/pipermail/discuss/attachments/20040714/5c8ce2f5/nasi_proglist.c
More information about the Discuss
mailing list