Re: custom memory manager..
- From: Bernhard Agthe <dark2star@xxxxxxx>
- Date: Thu, 17 Apr 2008 11:24:34 +0200
Hi,
I am developing a user level memory manager for a protocol stack. It
will replace the usual malloc() by something like my_malloc() and free
by my_free(). The basic idea is to minimize the chances of memory non-
avaliabiltiy, minimize system calls at run time thereby minimizing
risk for failure, and use the memeory in an effcient way.
To say somthing stupid: use Malloc and Free. They're really good ;-)
The problem is i donot want to change the prototype of my_malloc which
is currently same as malloc() but I also want to associate debug
information along wth every buffer allocated.
OK, here's a sample solution:
In your Memory manager keep track of things. You can add some data to
each memory block by malloc'ing a few (sizeof int) bytes more, writing
the size of the chunk to those bytes and returning the pointer to the
chunk, increased by the few bytes. In your Free, decrease the pointer,
read the info and release the memory.
See it as a finger exercise ;-)
Ciao...
.
- Follow-Ups:
- Re: custom memory manager..
- From: shiva
- Re: custom memory manager..
- References:
- custom memory manager..
- From: shiva
- custom memory manager..
- Prev by Date: Re: which is the hottest field in Embedded systems ,currently in market.
- Next by Date: Re: custom memory manager..
- Previous by thread: custom memory manager..
- Next by thread: Re: custom memory manager..
- Index(es):
Relevant Pages
|