|
|
| floodfill question |
|
Richard Phipps
Member #1,632
November 2001
|
In flood.c of the allegro source I see it grows an area of scratch memory. Which is defined in the aintern.h file: AL_INLINE(void, _grow_scratch_mem, (int size), { if (size > _scratch_mem_size) { size = (size+1023) & 0xFFFFFC00; _scratch_mem = realloc(_scratch_mem, size); _scratch_mem_size = size; } }) But I can't see where this memory is freed, does this memory always sit in the background after a floodfill? Am I missing something..??? |
|
Bob
Free Market Evangelist
September 2000
|
scratch memory is used throughout Allegro and is shared everywhere. It's only freed when Allegro exits. -- |
|
ReyBrujo
Moderator
January 2001
|
Yeah, I was at a miss the first time I checked polygon source. I wonder if you declare it extern and link with Allegro, later you can use it for your own purposes...
-- |
|
Richard Phipps
Member #1,632
November 2001
|
Repeated use of floodfill seems to be growing this scratch_memory too much. Is there a way I can free the memory after each fill, without damaging the rest of Allegro? |
|
Bob
Free Market Evangelist
September 2000
|
Quote: Repeated use of floodfill seems to be growing this scratch_memory too much. Is there a way I can free the memory after each fill, without damaging the rest of Allegro? The scratch memory is reused between floodfills. You'll only end up allocating enough scratch to do the largest floodfill you've ever done. -- |
|
Richard Phipps
Member #1,632
November 2001
|
Ah I see, I misunderstood. Sorry about that! |
|
|