From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: malloc and SIGSEGV Date: Tue, 12 Nov 1996 18:34:45 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 36 Message-ID: <328933C5.1ABA@cs.com> References: <32883519 DOT 41C67EA6 AT informatik DOT uni-hildesheim DOT de> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp108.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Ingo Stierand To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Ingo Stierand wrote: > > Hy, > I have a little problem with malloc. In the X'th malloc my program > will abort with SIGSEGV. Is this a known problem? Yes. In general, it's a bad idea to do extremely large numbers of mallocs, but the instance you report is a slight limitation in the cwsdpmi DPMI host for djgpp. Solution: 1) Make sure you have the latest version of cwsdpmi: v2misc/csdpmi3b.zip 2) Read the file 'CWSPARAM.DOC' that comes with the distribution, and then run 'cwsparam' to increase the internal heap size of cwsdpmi.exe. Increasing the heap size directly increases the number of simultaneous memory blocks you can allocate, but increases the memory footprint of cwsdpmi. 3) Even though the above will solve your problem, I recommend highly that you work to make your program more efficient in its use of memory by allocating large blocks and dividing them up as necessary. This is a good programming technique as well. FYI, cwsdpmi is the only host that suffers from this problem - Windoze, QDPMI, 386MAX, et. al., seem to be perfectly fine for large numbers of allocations. But that's the tradeoff you make for greater performance and efficiency. :) -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | * Proud user of DJGPP! * | http://www.cs.com/fighteer | | ObJoke: If Bill Gates were a robber, not only would he | | shoot you, but he'd send you a bill for the bullets. | ---------------------------------------------------------------------