Re: [arm-gnu] How do "new" and "delete" work without OS?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [arm-gnu] How do "new" and "delete" work without OS?
- To: arm-gnu@xxxxxxxxxxxxxxxx
- Subject: Re: [arm-gnu] How do "new" and "delete" work without OS?
- From: Paul Brook <paul@xxxxxxxxxxxxxxxx>
- Date: Thu, 16 Sep 2004 13:47:45 +0100
On Thursday 16 September 2004 09:31, Chen Bill-R63518 wrote:
> Dear all,
> I am using arm-none-elf-g++ to compile cpp files. Then I will use
> arm-none-elf-ld link the objects with libstdc++.a. The output codes will
> run without any OS. And in the c++ source code some "new" and "delete"
> operations are called, ie. there are some dynamic memory allocation.
>
> Here are my questions:
> How do the operator "new" and "delete" in the c++ lib work to manage the
> memory without OS? Should I override the "new" and "delete" operator myself
> to implement dynamic memory allocation?
The default libstdc++ operator new and delete use the libc malloc and free.
Newlib implements a heap based malloc and free using information obtained from
the program loader/debug monitor.
To implement different memory management you probably want to modify/replace
the newlib malloc and free routines.
Paul