more cache manager issues

Eric Valette valette at crf.canon.fr
Mon Nov 6 10:20:14 UTC 2000


Till Straumann wrote:
> 
> Eric Norum wrote:
> 
> > Till Straumann wrote:
> > >
> > > Browsing through the cache manager implementation of
> > > `rtems-ss-20000929' caused me having some more questions
> > > / suggestions:
> > >
> > >  - cache_aligned_malloc() (currently not called by any piece of code)
> > > must not
> > >      be used. Calling `free' on memory allocated by
> > > cache_aligned_malloc() results
> > >      in heap corruption.
> > >
> >
> > Here's my solution to the problem.  Note that a block of memory
> > allocated by rtems_cache_aligned_malloc can only be freed by calling
> > rtems_cache_aligned_free and that rtems_cache_aligned_free can be used
> > only to free a block of memory allocated by rtems_cache_aligned_malloc.
> 
> An alternative to this approach would be letting
> rtems_cache_aligned_malloc()
> using its own heap with a bigger (cache aligned) granularity.
> 
> One global `free(arg)' function could then determine the heap
> corresponding to the argument
> by comparing the argument pointer to the standard heap / aligned heap
> starting and end addresses.
> 
> Even more elegant would of course be an object oriented approach with a
> virtual `free' member
> function (or a field in the block header holding the information about
> which version of `free' must
> be used for that specific block of memory).
> 
> IMHO, the need to call a `special' deallocator function is very error
> prone.

Just some words to point out what this message makes me think :
	- I want other special purpose allocator (cache inhibited, ...),
	- I may want to allocate other type of special memory (dual ported,
...),
	- Some system may have fast and non fast memory,

any malloc without field for specifying memory type will cause problem.
cache_aligned_malloc() is not a conevient API... Sometime on Chips with
MMU on I want page aligned memory because memory protection granularity
is page ...

Just my 0.02 $

-- 
   __                 
  /  `                   	Eric Valette - Canon CRF
 /--   __  o _.          	Canon Development Europe Team Leader
(___, / (_(_(__         	Rue de la touche lambert
				35517 Cesson-Sevigne  Cedex
				FRANCE
Tel: +33 (0)2 99 87 68 91	Fax: +33 (0)2 99 84 11 30
E-mail: valette at crf.canon.fr	http://www.crf.canon.fr



More information about the users mailing list