hell-o !~
i faced weird problem during usage boost::pool_allocator.
after i've changed: -
typedef boost::shared_ptr< param > ParamPtr;
-
typedef std::vector< ParamPtr > ParamPtrVector;
-
with: -
typedef boost::shared_ptr< param > ParamPtr;
-
typedef std::vector< ParamPtr, boost::pool_allocator<ParamPtr> > ParamPtrVector;
-
smth goes wrong:
Segmentation fault: 11 (core dumped)
before that i didn't get any sever errors...
i've found out where it breaks in my code: -
class UsersFunction : public Function {
-
boost::shared_ptr< Statement > _pStmtPtr; //body of function
-
public:
-
UsersFunction(const Function::FunctionHeader &header, const boost::shared_ptr< Statement > &pStmtPtr = boost::shared_ptr<Statement>())
-
: Function(header),
-
_pStmtPtr(pStmtPtr) {} HERE !!!
-
//...
-
};
-
-
//parent class
-
class Function {
-
Value _result;
-
public:
-
struct FunctionHeader {
-
std::string _name;
-
Value::E_TYPE _returnType;
-
std::size_t _argsCount;
-
ParamPtrVector _params;
-
FunctionHeader(const std::string &name, const Value::E_TYPE returnType, const std::size_t argsCount, const ParamPtrVector ¶ms)
-
:_name(name), _returnType(returnType), _argsCount(argsCount), _params(params) {}
-
-
//...
-
};
-
protected:
-
FunctionHeader _header;
-
protected:
-
Function(const FunctionHeader &header)
-
:_header(header),
-
_result(header.getType()) {}
-
~Function() {}
-
Function &operator=(const Function &other) {
-
if (this != &other) {
-
_header = other._header;
-
}
-
return *this;
-
}
-
public:
-
-
//...
-
};
-
smth goes wrong in boost simple_segregated_storage.hpp function: -
//boost/simple_segregated_storage.hpp file
-
template <typename SizeType>
-
void * simple_segregated_storage<SizeType>::segregate(
-
void * const block,
-
const size_type sz,
-
const size_type partition_sz,
-
void * const end)
-
{
-
// Get pointer to last valid chunk, preventing overflow on size calculations
-
// The division followed by the multiplication just makes sure that
-
// old == block + partition_sz * i, for some integer i, even if the
-
// block size (sz) is not a multiple of the partition size.
-
char * old = static_cast<char *>(block)
-
+ ((sz - partition_sz) / partition_sz) * partition_sz;
-
-
// Set it to point to the end
-
nextof(old) = end;
-
-
// Handle border case where sz == partition_sz (i.e., we're handling an array
-
// of 1 element)
-
if (old == block)
-
return block;
-
-
// Iterate backwards, building a singly-linked list of pointers
-
for (char * iter = old - partition_sz; iter != block;
-
old = iter, iter -= partition_sz)
-
nextof(iter) = old; HERE !!!
-
-
// Point the first pointer, too
-
nextof(block) = old;
-
-
return block;
-
}
-
here is my stack on this moment:
iter = 0x282ffff8 <error reading address 0x282ffff8: Bad address>
0x0805b0f8 boost::simple_segregated_storage<unsigned int>::segregate
0x0805b158 boost::simple_segregated_storage<unsigned int>::add_block
0x0805b352 boost::simple_segregated_storage<unsigned int>::add_ordered_block
0x0805b3cc boost::simple_segregated_storage<unsigned int>::ordered_free_n
0x0805b443 boost::pool<boost::default_user_allocator_new_dele te>::ordered_free
0x0807c04c boost::singleton_pool<boost::pool_allocator_tag,8, boost::default_user_allocator_new_delete,boost::de tail::pool::pthred_mutex,32>::ordered_free
0x0807c078 boost::pool_allocator<boost::shared_ptr<param>,boo st::default_user_allocator_new_delete,boost::detai ls::pool:pthread_mutex,32::deallocate
0x0807c09e std::_Vector_base<boost::shared_ptr<param>,boost:: pool_allocator<boost::shared_ptr<param>,boost::def ault_user_allocator_new_delete,boost::details::poo l::pthread_mutex,32> >::_M_deallocate
0x0807c3a6 ~_Vector_base
0x0807c562 ~vector
0x0807c5a5 ~FunctionHeader
0x0806f170 Syntaxer::FunctionsDeclarations
0x0806fe17 Syntaxer::run
0x0804a796 main
what is wrong with my code and where's my fault? thanks.
0 1771 Sign in to post your reply or Sign up for a free account.
Similar topics
by: sbobrows |
last post by:
{Whilst I think much of this is OT for this newsgroup, I think the issue
of understanding diagnostics just about gets under the door. -mod}
Hi,
I'm a C++ newbie trying to use the Boost regex...
|
by: GujuBoy |
last post by:
i am trying to make a cpp file which will allow me to make an ARRAY and
pass it as a LIST to python usin boost
can someone please help...i have include <list.hpp> but i dont kno whow
to access...
|
by: FBergemann |
last post by:
I use SunOS 5.8, gcc 3.3.2, boost 1.33.1.
I have build the entire boost package and try to compile a simple
example:
#include <iostream>
#include <string>
#include <boost/regex.hpp //...
|
by: Osiris |
last post by:
I have these pieces of C-code (NOT C++ !!) I want to call from Python.
I found Boost.
I have MS Visual Studio 2005 with C++.
is this the idea:
I write the following C source file:...
|
by: g |
last post by:
Hello,
is there any library for C as Boost is for C++?
thanks in advance,
|
by: Chris Jones |
last post by:
Hi,
I've experimenting with using boost::pool_allocator with std::vector and gcc
(4.1)., and I am having problems with segmentation violations. Below I give
a simple example of one way I am...
|
by: Barry |
last post by:
As boost::pool_alloc use singleton holder for pool allocator, client
programmers have to reclaim the memory by hand through calling
singleton_pool<alloc_tag, elem_size>::purge_memory() or something...
|
by: Juha Nieminen |
last post by:
I tested the speed of a simple program like this:
//------------------------------------------------------------
#include <list>
#include <boost/pool/pool_alloc.hpp>
int main()
{
typedef...
|
by: blackbiscuit |
last post by:
Hi,
I wanna have boost installed on my mac leopard system. I have searched
through google and it seems the boost can not been directly installed
but through tools like macports. Since it is...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
| |