[Freeswitch-dev] freeswitch development question (memory allocation?) [SOLVED]

Apostolos Pantsiopoulos regs at kinetix.gr
Thu Jan 29 05:00:38 PST 2009


I found it out by myself!
 (why is it that we always come with the solution right after posting to 
the list?)

I inserted :

thread_params = switch_core_session_alloc(session, sizeof(*thread_params));

before the pool initialization.

But still,  can I get some answers to the questions bellow about
how to effectively handle memory allocations?



Apostolos Pantsiopoulos wrote:
> I have the code below :
>
> struct radacct_thread_handle {
>         switch_core_session_t *session;
>         switch_mutex_t *mutex;
>         switch_thread_cond_t *cond;
> };
>
> static switch_status_t my_on_routing(switch_core_session_t *session){
>
>         switch_thread_t *thread;
>         switch_threadattr_t *thd_attr = NULL;     
>
>         switch_memory_pool_t *pool;
>
>         struct radacct_thread_handle *thread_params = NULL;
>        
>         pool = switch_core_session_get_pool(session);     
>
>         thread_params->session = session;
>        
>         ...
>        
> }
>
> when the program reaches the last line (thread_params->session = session;)
> I get a core dump. Is this a memory allocation error? Is it because I am 
> making
> use of the wrong pool? Please enlighten me because I am not an experienced c
> programmer, and I am struggling to get familiar with the FS API.
>
>   


-- 
-------------------------------------------
Apostolos Pantsiopoulos
Kinetix Tele.com R & D
email: regs at kinetix.gr
------------------------------------------- 




More information about the Freeswitch-dev mailing list