自定义内存分配器是否可能影响Windows API MapViewOfFile?

我在我的双向链表类中添加了一个自定义内存分配器(http://www.codeproject.com/KB/stl/blockallocator.aspx) . 自定义内存分配器适用于STL set,map,list . 但是,对于我的双重链接类,我注意到MapViewOfFile无法正常运行 . 以下是我调用MapViewOfFile的方法:MapPtr =(char *):: MapViewOfFile(hMapping,FILE_MAP_WRITE | FILE_MAP_READ,0,baseoff,mappedlength);当我在Windows调试器中查看MapPtr时,我期待像0x09aa000“" but instead I see 0x09aa000 " 23456 FRANCISCO BUSQUETS”

以下是构建双向链表的方法:
dlist> * myaccesses;

myaccesses = new dlist>();

以下是代码的摘录 . 我尝试在block_allocator模板代码中设置一个Debug断点,但是当我调用MapViewOfFile时,没有任何断点被点击 . 请建议我如何找到或解决问题 .

template <typename Allocator = allocator< Range > > 
        class dlist{
            public:
      Allocator alloc;
      class node{
        public:
            Range value;           
            node *next;          
            //pointer to next node 
             node *prev;          
            //pointer to previous node 
            node(){ next = NULL; prev = NULL; }
            node(Range r){  value = r; next = NULL; prev = NULL; }

      };
      node *front;       //pointer to front of list   
      node *back;        //pointer to back of list 
      int size;
      dlist(){  front=NULL; back=NULL; size = 0;}
      void insertFront(Range value);           
      void insertBack(Range value);
      void removeFront();
      void removeBack();
      void insertBefore(Range value,node *nodeB);
      void insertAfter(Range value,node *nodeA);
      void removeBefore(node *nodeB);
      void removeAfter(node *nodeA);
      int removeNode(node *newNode);
      node * getFront(void){ return front; }
      node * getBack(void){ return back; }
      int getSize(){ return size; }
};

template <typename Allocator >
 void dlist<Allocator >::insertBefore(Range value,node *nodeB)      
 {      node *newNode;      
    try {
        typename Allocator::rebind<node>::other pointer_alloc;         
        newNode = pointer_alloc.allocate(1); 
    }
    catch(std::bad_alloc &ba){
            printf("Catch exception\n");
    }
    newNode->prev=nodeB->prev;  
    newNode->next =nodeB;       
    newNode->value =value;          
    if(nodeB->prev==NULL){      
        this->front=newNode;            
    }   
    nodeB->prev=newNode;        
 }

template <typename Allocator>
 void dlist<Allocator>::removeNode(node *nodeToRemove){ 
if(nodeToRemove==this->front)   {       
    this->front=this->front->next;
    alloc.deallocate(nodeToRemove,1); 
    nodeToRemove = NULL;
    this->front->prev=NULL;
    size -= 1;
}   
else if (nodeToRemove==this->back)  {       
    this->back=this->back->prev;    
    alloc.deallocate(nodeToRemove,1);
    nodeToRemove = NULL;
    this->back->next=NULL;  
}   
else{   
    nodeToRemove->prev->next=nodeToRemove->next;    
    nodeToRemove->next->prev=nodeToRemove->prev;
    alloc.deallocate(nodeToRemove,1);
    nodeToRemove = NULL;
}
size -= 1;
}

回答(0)