Mail Archives: djgpp/1995/06/13/23:34:56
Art S. Kagel wrote:
> I have a sort program I ported to DJGPP which malloc() and free()s all over the
> place and it has never failed. I have sorted files of several hundred thousand
> records which translates to over 1/2 million malloc()s and matching free()s.
>
Doing around 1/2 million function calls to malloc(), isn't that a bit
inefficient, considering the enourmous execution thread the system
has to follow to allocate a single block of memory?
Using the stack might be a much faster method as you only need 3
assembly language instructions for the same task.
Eg.
push ebp
mov ebp,esp
sub ebp,BLOCKSZ
Regards, Ron.
********************************************************************
| Author.............. Ron Grunwald |
| Internet............ r DOT grunwald AT cowan DOT edu DOT au |
| Phone............... (09)273 8027 or (09)273 8468 |
|------------------------------------------------------------------|
| Department.......... Computer Operations and Systems Management |
| Division/Faculty.... Information Technology |
| Institute........... Edith Cowan University, Churchlands |
| Location............ Perth, Western Australia |
********************************************************************
"I don't have any solution but I certainly admire the problem!"
- Raw text -