Mail Archives: djgpp/1996/11/12/19:47:35
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. |
---------------------------------------------------------------------
- Raw text -