On Mon, 1 Dec 2003, Ronald Bultje wrote:

> On Mon, 2003-12-01 at 00:06, Steven M. Schultz wrote:
> >     As a temporary measure you can try editing the compat function
> >     posix_memalign to return an aligned address.  NOTE:  this will result
> 
> Is this function called often? If not, it can be easily worked around by
> creating a linked list of allocated pointers from posix_memalign().
> Then, return (ret + 3) &~ 3. In posix_memalign_free, check the given
> pointer against each value in the list (listval + 3) &~ 3 and free
> 
        Well, it'd be either 16 or 64 byte alignment but the same thing 
        could be done of course.

        That is what I suggested Nicolas try as an experiment - adjust the
        value returned from the compatibility posix_memalign() function to
        see if the problem goes away.   That would be the conclusive proof
        that the alignment is indeed the cause of the problem.

> If we don't call this too often, this will have no measurable
> performance effects.

        It's not the performance issue at all - the function isn't called
        often enough to make a difference.

        The goal was to allocate memory that could be released by calls
        to the standard free() function and not have the calling program
        remember which buffers were allocated by posix_memalign() and
        which were allocated by malloc()

        The encoder shared library will be used outside of mpeg2enc so I
        do not think it is reasonable to insist that callers of the 
        functions in libmpeg2encpp.so have to track which buffers need 
        posix_memalign_free() and which need free().

        At the moment the buffers are not free'd so it does not matter if
        the return value from posix_memalign() is suitable for free().  That
        will not always be true though so a longer term solution needs to 
        be found.

        Cheers,
        Steven Schultz



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to