[NTLUG:Discuss] Stack size or malloc problem
Steve Baker
sjbaker1 at airmail.net
Wed Jul 14 18:57:31 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,
...are you maybe using Fedora? They (for some unaccountable reason)
reduced the default stack size in the kernel.
> or 2) malloc and free
> problems. I know my mallocs and free are right...
Are you **SURE** ? That's by far the most likely thing. Something,
somewhere in your program could easily be scribbling somewhere it
shouldn't. A program with that sort of error can sometimes appear to
be working for *years* before the problem finally surfaces.
> I say the code is good because I have cut it out, put it in a
> small test program and it passed.
That proves *NOTHING*.
> I can tell where it dies using gdb,
> but I am stumped.
Try:
export MALLOC_CHECK_ = 2
...then run your program normally (without gdb)
Do a 'man malloc' to find an explanation of what this does.
---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1 at airmail.net> WorkEmail: <sjbaker at link.com>
HomePage : http://www.sjbaker.org
Projects : http://plib.sf.net http://tuxaqfh.sf.net
http://tuxkart.sf.net http://prettypoly.sf.net
-----BEGIN GEEK CODE BLOCK-----
GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
-----END GEEK CODE BLOCK-----
More information about the Discuss
mailing list