[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] porting freetype to Texas DSP C55x

From: david turner
Subject: Re: [ft-devel] porting freetype to Texas DSP C55x
Date: Thu, 09 Mar 2006 11:39:04 +0100
User-agent: Thunderbird 1.5 (Windows/20051201)

Peter M a écrit :

I have tried to make the changes and I have next problems:

- I need size of the block to "free":

I tried to save it in the “user”

This cannot be done easily, since FreeType doesn't always store the size of
allocated blocks. You'll need to handle this in your allocator (e.g. allocate a slightly larger block, store the size and a magic number at the start, then return
the address of the first free bytes in it. Do the reverse in 'free')

I'm sad to say that your code is totally bogus. The value stored in "memory->user" is going to change on each allocation, and will certainly never correspond to the
block size you want to free when the CPU reaches ft_free.

- When I use "MEM_redefine" in don’t get a pointer returned:

So I redefine the block and return the same pointer.

What does this MEM_redefine function does then ? Is is a macro that changes the
value of the 'block' parameter.

Why are you returning 'memory' instead of 'block' by the way ? This looks insane.

When I debug the code I see code cycles every 53 steps. Alloc trays to

Allocate the same size and returns the same pointer.

Can someone help?

this might be explained by the buggy behaviour described previously. There are great chances that you're essentially trashing your memory manager's internal data structures.

Hope this helps,

- David Turner
- The FreeType Project (



ft_alloc( FT_Memory memory,

long size )


FT_UNUSED( memory );

memory->user = (void*)size;

return (void* )MEM_alloc( SDRAM, size, 2 );

//return malloc( size );




ft_realloc( FT_Memory memory,

long cur_size,

long new_size,

void* block )


FT_UNUSED( memory );

FT_UNUSED( cur_size );

memory->user = (void*)new_size;

MEM_redefine( SDRAM, block, new_size );

return (memory);

//return realloc( block, new_size );




ft_free( FT_Memory memory,

void* block )


FT_UNUSED( memory );

(void* ) MEM_free( SDRAM, block, (int)memory->user );

// free( block );



Peter M


Freetype-devel mailing list

Information contained in this email message is confidential and may be 
privileged, and is intended only for use of the individual or entity named 
above. If the reader of this message is not the intended recipient, or the 
employee or agent responsible to deliver it to the intended recipient, you are 
hereby notified that any dissemination, distribution or copying of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the address@hidden and destroy the original 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]