Ondrej Zajicek <santiago@crfreenet.org> wrote on 2010/04/23 12:01:29:
On Fri, Apr 23, 2010 at 11:37:56AM +0200, Joakim Tjernlund wrote:
realloc() is used only for a persistent buffer to grow it sufficiently large. So it is called only small number of times during the run of the program and not in subsequent LSA originations. Therefore it is not an issue.
It would be better if you used the same (linear space) as you do for received LSA's. I guess the received LSA's has a MAX size? Then you could allocate space as big as the MAX received LSAs size, add data to it and, if you want to, realloc the the whole LSA to a smaller size.
Received LSAs are copied from RX buffer to the space allocated for them. Originated LSAs are prepared in the persistent buffer and then copied to the space allocated for them. In both cases the final space for the LSA is allocated once (not reallocated) for the final size of the LSA.
I must be missing something then(not surprising as I just started looking at BIRD). Why do you need the separate allocation for the body of the LSA then? Why not just adding entries to the allocated LSA header? Jocke