I believe you need a destructor method for your Packet type to deallocate
the memory properly.
gdb with 'list' after the segfault occurs could help you narrow down what
line of code is actually throwing the fault.
-Griffin Wright
On Thu, 7 Apr 2011 23:39:43 +0530, sunitha p wrote: Regarding the
bad-alloc error...
I am creating a new packet with just a new command.
Added the constructor in packet.hh
Packet(MemCmd _cmd)
:cmd(_cmd)
{
}
void setAddr(Packet *pkt,Addr addr)
{
pkt->addr=addr;
flags.set(VALID_ADDR);
}
the new packet is created as
PacketPtr inv_pkt= new Packet(MemCmd::ReqMove);
inv_pkt->setAddr(inv_pkt,temp);
inv_pkt->setDest(-1); //as it is be broadcasted
inv_pkt->setExpressSnoop();
memSidePort->sendTiming(inv_pkt);
//after the work is done in timing access the control comes here
delete inv_pkt;
--
---
but l am getting seg fault after certain time execution when i delete the
packet
can u help me out..y it is so...
On Wed, Apr 6, 2011
at 10:44 PM, Korey Sewell wrote:
Wow,
that's a great tip about valgrind.
The only question now is: How am I going to get all that time I spent
sifting through valgrind output back?! haha....
Thanks again,
Korey
On Wed, Apr 6, 2011 at 1:03 PM, Ali Saidi wrote:
> Korey,
>
> If you're using valgrind you should use the suppressions options to get
rid
> of the Python issues that valgrind doesn't understand:
> --suppressions=util/valgrind-suppressions will do the trick.
>
> Ali
>
>
> On Wed, 6 Apr 2011 12:53:55 -0400, Korey Sewell wrote:
>>
>> There is a finite amount of memory available on any particular system.
>>
>> So if you keep allocating memory and never delete then yes eventually
>> you would run out of memory to allocate and get a std:bad_alloc.
>>
>> If you want to be check where memory leaks are, there is a program
>> called "valgrind" that you can use. There are plenty of online
>> tutorials on how to use it. Note, that if you do use it, the
python
>> part of M5 makes valgrind act not so nice, but once you get to the
>> "Simulation Started..." part of the output then valgrind should help.
>>
>> On Wed, Apr 6, 2011 at 12:41 PM, sunitha p wrote:
>>>
>>> no...so..shud i delete this packet..
>>>
>>> On Wed, Apr 6, 2011 at 5:58 PM, Nilay Vaish wrote:
>>>>
>>>> On Wed, 6 Apr 2011, sunitha p wrote:
>>>>
>>>>> I am just creating a new packet.
>>>>>
>>>>> PacketPtr inv_pkt= new Packet(pkt,true);
>>>>>
>>>>> changed the acket address and command is changed to a new command
which
>>>>> is
>>>>> just the a request.
>>>>>
>>>>> inv_pkt->setAddr(inv_pkt,temp);
>>>>> inv_pkt->cmd=MemCmd::ReqMove;
>>>>>
>>>>> On Wed, Apr 6, 2011 at 5:15 PM, Nilay Vaish wrote:
>>>>>
>>>>>> On Wed, 6 Apr 2011, sunitha p wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>>
>>>>>>> I added a new command with just the request attribute. But if i
try
>>>>>>> to
>>>>>>> run
>>>>>>> for 100million instructions i am getting the following
error. am
>>>>>>> using
>>>>>>> spec2006 bench marks
>>>>>>>
>>>>>>>
>>>>>>> terminate called after throwing an instance of 'std::bad_alloc'
>>>>>>> what(): std::bad_alloc
>>>>>>> Program aborted at cycle 11199095000
>>>>>>> Aborted
>>>>>>>
>>>>>>> even i checked the benchmarks html...dey suggest to run on 64 bit
>>>>>>> machine..But even on it..am geting the same error.
>>>>>>> can anyone please tell..wat is this error and why?
>>>>>>>
>>>>>>> --
>>>>>>> Thanks & Regards
>>>>>>>
>>>>>>> Sunitha.P
>>>>>>> 9092892876
>>>>>>>
>>>>>>>
>>>>>> Are you using malloc and / or new to allocate memory dynamically?
>>>>>>
>>>>>> --
>>>>>> Nilay
>>>>>> _______________________________________________
>>>>
>>>>
>>>> And do you delete this packet afterwords?
>>>>
>>>> --
>>>> Nilay
>>>> _______________________________________________
>>>> m5-users mailing list
>>>> [email protected] [7]
>>>> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users [8]
>>>
>>>
>>>
>>> --
>>> Thanks ">- Korey
_______________________________________________
m5-users mailing list
[email protected] [9]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users [10]
--
Thanks & Regards
Sunitha.P
9092892876
Links:
------
[1] mailto:[email protected]
[2] mailto:[email protected]
[3] mailto:[email protected]
[4] mailto:[email protected]
[5] mailto:[email protected]
[6] mailto:[email protected]
[7] mailto:[email protected]
[8] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
[9] mailto:[email protected]
[10] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users