Re: Two C++ questions

From: tom_usenet (tom_usenet_at_hotmail.com)
Date: 04/28/04


Date: Wed, 28 Apr 2004 09:55:57 +0100

On Tue, 27 Apr 2004 11:04:11 -0700, Julie <julie@nospam.com> wrote:

>Claudio Puviani wrote:
>> > If you are going to use the std functions, allocate the memory w/ new.
>>
>> The two concepts are COMPLETELY unrelated. There is nothing practical or
>> theoretical that correlates how and where memory is allocated with the way it
>> should be manipulated.
>
>You don't allocate memory w/ new, you allocate space for instances of objects,
>be they classes or POD types.

void* mem = ::operator new(42);

>malloc is the only way to allocate 'memory'.

Really!?

Tom

-- 
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html


Relevant Pages

  • Tru64 issues with Infinite limits
    ... An automated test in my nightly build was failing due to Out of Memory ... Cannot allocate block 146 ...
    (comp.unix.tru64)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (comp.lang.cpp)
  • Re: [ckrm-tech] RFC: Memory Controller
    ... I'd pay more attention to kernel memory accounting and less ... How would you allocate memory on NUMA in advance? ...
    (Linux-Kernel)
  • Re: NdisAllocateMemoryWithTag(Priority) -> Does it ensure Congtiguous physical memory by default
    ... I believe in W2K8 if your device does 64 bit DMA, when you call NdisMAllocateSharedMemory you will get high physical addresses before getting low addresses. ... NDIS does not provide an API to allocate physically contiguous memory outside what HAL DMA APIs provide. ...
    (microsoft.public.development.device.drivers)