Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2007-09-19 15:11:07


On 09/19/07 13:46, Achilleas Margaritis wrote:
[snip]
>> I added some debug prints to the _page::new:
>>
>> //allocate page from mspaces
>> void *_page::operator new(size_t size) {
>> std::cout<<"_page::operator new at "<<__FILE__<<":"<<__LINE__<<"\n";
>> void*p=
>> #if 1
>> _CPPGC_MALLOC(gc::_mem_space, size);
>> #else
>> 0;
>> #endif
>> std::cout<<"_page::operator new at p="
>> //<<p
>> <<"\n";
>> return p;
>> }
>>
>> When the '#if 1' is changed to '#if 0', I get:
>>
>> ***running ../../bin.v2/sandbox/axilmar/gcc-4.1/debug/main_test
>> _page::operator new at ./cppgc/include/cppgc.hpp:648
>> _page::operator new at p=
>> running main_test.cpp
>> p=0x8456008
>> a_page=0
>> ...updated 4 targets...
>>
>> Compilation finished at Wed Sep 19 12:41:55
>>
>> main_test only contains:
>>
>> #include "cppgc.hpp"
>> #include <iostream>
>> int main(void)
>> {
>> void*p=dlmalloc(20);
>> void*a_page=_page::operator new(sizeof(_page));
>> std::cout<<"running "<<__FILE__<<"\n";
>> std::cout<<"p="<<p<<"\n";
>> std::cout<<"a_page="<<a_page<<"\n";
>> return 0;
>> }
>
> I removed dlmalloc...I will try to compile it under Linux as soon as
> possible.

I'm mystified by what's happening because when I changed main to:

       _page*a_page=new _page;

I got the segfault again even when the _page::operator new had:

     void*p=
     #if 0
       _CPPGC_MALLOC(gc::_mem_space, size);
     #else
       0;
     #endif

???


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk