On Thu, Jul 9, 2009 at 5:23 PM, Pratibha S<[email protected]> wrote:
> Hi,
> PoolC get() is returning NULL even though not Pool.empty() and
> Pool.size()>0.
> I allocate a pointer-to-struct say 'position_t' having three pointers v[3],
> typedef position * position_t;
> interface Pool<position>;
> void New_position()
>  {       position_t pos;
> if(! call Pool.empty()){
>         atomic{
>         pos = call edgePool.get();
>         }}
>         else
>         {
>         dbg_clear("usr","Out of memory - %d\n",call Pool.size());
>         exit(0);
>         }
>         if(pos == NULL) // Becomes TRUE and printing non_zero size
>            dbg_clear("usr", "Failed allocation -%d\n", call Pool.size());
>        pos->v[0] = NULL; // SEGMENTATION FAULT OCCURS HERE
>        pos->v[1] = NULL;
>        pos->v[2] = NULL;
>            return pos;
> }
>  this code doesn't cause segmentation fault every time, it is
> called. variables in Pool will be constantly allocated and freed. after some
> put()s and get()s, this is causing error. Can anyone tell me why?

You are checking Pool and getting from edgePool?

- om_p

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to