Even if I comment as shown below and
add a simple printf statement it fails but if I just keep the first line
ep_alloc() and comment everything
With no printf addition then it works.:--
if (check_col(pinfo->cinfo,COL_INFO))
{
temp_str = ep_alloc(STRING_BUFFER);
printf( "[%s]
%s ", message->direction, message->message_type);
// g_snprintf(
temp_str, sizeof(temp_str),
"[%s] %s ",
message->direction, message->message_type);
// col_add_str(pinfo->cinfo,
COL_INFO, temp_str);
}
Thanks
Hemant
From: Kumar, Hemant
Sent: Friday, July 25, 2008 2:20
PM
To: 'Developer support list for
Wireshark'
Subject: RE: [Wireshark-dev] Out
of Memory issue
Hello Harris
Below is the code section from my packet_myprotocol.c.
I was able to finally locate the memory issue with code snippet;--
If I comment this,
everything works fine.
So am I wrong in allocating memory for the string which I want to display
in INFO section for the message
in display pane.
` #define
STRING_BUFFER 256
Char *temp_str = NULL;
/* Clear out the stuff in info column*/
if (check_col(pinfo->cinfo,COL_INFO))
{
col_clear(pinfo->cinfo,COL_INFO);
}
if (check_col(pinfo->cinfo,COL_INFO))
{
temp_str = ep_alloc(STRING_BUFFER);
g_snprintf( temp_str, sizeof(temp_str),
"[%s] %s ",
message->direction, message->message_type);
col_add_str(pinfo->cinfo, COL_INFO, temp_str);
}
Do I need to use some other fucntion to
deallocate memory for temp_str?
Because my guess was that it will be
automatically taken care off by g_snprintf() by use of g_free().
Thanks for all your inputs. I think I am
pretty close to resolving this bug of mine.
Thanks
Hemant
-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Friday, July 25, 2008 12:00 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] Out of Memory issue
On Jul 24, 2008, at 5:12 PM, Kumar, Hemant wrote:
> It dies out in following TRY statement:--
>
> TRY {
> read_packet(cf,
dfcode, data_offset);
> }
> CATCH(OutOfMemoryError) {
>
> |
> |
> |
> |
> }
> ENDTRY;
> }
Presumably that's the statement in cf_read() in file.c (i.e.,
presumably your dissector isn't itself reading packets).
> Any idea or any memory management routine which needs to be
> implemented in my
> Plugin dissector code?
We'd probably need to see your dissector to see if it's leaking
memory, or if it's correctly using some Wireshark facility that uses a
lot of memory.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
https://wireshark.org/mailman/listinfo/wireshark-dev