#: 11202 S12/OS9/68000 (OSK)
26-Jun-91 21:15:33
Sb: #11187-#Allocation help
Fm: Bob van der Poel 76510,2203
To: Pete Lyall 76703,4230 (X)
Pete/JJ, I think that the 'nicest' way to do the allocation *is* with two
malloc()s. But, even if malloc() doesn't need to call the system at all for
memory it still exacts a fairly heavy price in overhead. Each malloc() has to
keep track of the memory point and the size (I believe it uses a linked list
for this). Something like 8 bytes per call? The other un-nice thing about two
malloc()s is that two free()s are needed to get rid of the stored stuff--again,
not a big deal, but one more thing to go wrong!
BTW, I "discovered" an interesting thing about the the 68K compilier--it does
structure assignments and will pass structures by value (pushes the whole thing
onto the stack!). Don't ask just how I found this out .
There is 1 Reply.
|