Re: malloc() implementation



Flash Gordon wrote:
John Devereux wrote:
Flash Gordon <spam@xxxxxxxxxxxxxxxxxx> writes:

You can't write a malloc routine in standard C which might be part of
why it is in the standard library, hence the suggestion of asking in a
Linux group.

What you *can* do though is statically allocate a memory buffer, then
allocate out of that with your own "malloc".

True, as long as you call is something other than malloc ;-)
It all depends on what the OP actually wants to achieve.

Wouldn't interpositioning allow you to define a default global symbol "malloc" that would essentially overwrite the Standard one?

Not, mind you, something I recommend, but isn't one of the hallmarks of C that one can do this without constraint, making all code (including any external libs that are linked in later) use the non-standard function?
.



Relevant Pages

  • Re: malloc() implementation
    ... John Devereux wrote: ... why it is in the standard library, hence the suggestion of asking in a ... Linux group. ... allocate out of that with your own "malloc". ...
    (comp.lang.c)
  • Re: malloc() implementation
    ... Flash Gordon writes: ... why it is in the standard library, hence the suggestion of asking in a ... Linux group. ... What you *can* do though is statically allocate a memory buffer, ...
    (comp.lang.c)
  • RE: One person multiple tasks (newbie)
    ... pain when my employee fills out the PWA timesheet. ... The bill/nonbill calendars suggestion is interesting. ... Allocate the first hour each day to the non-billable task ... I plan to have her use PWA timesheets to record her time, ...
    (microsoft.public.project)
  • Re: Malcolms new book - Chapter 1 review
    ... of memory I allocate to some "reasonable" size; ... think of this as a friendly suggestion for a new and useful ... feature, not necessarily as a bug report. ...
    (comp.lang.c)
  • Re: About Linux 9 nstallation.
    ... suggestion to resolve this problem ... Did you miss the suggestion that you ask Linux questions on a Linux group? ...
    (comp.unix.solaris)