memory leakage problem in erl_format in windows enviroment

maruthavanan s <>
Fri May 20 14:25:21 CEST 2005


hi!

I am using erl_interface in windows enviroment with otp R10B-2. i am using 
the following function to send messages from c exe to erlang node.

void send_5to_enode(int e1,int e2,int e3,int e4, int e5)
{
ETERM *t1;
int Result;
HANDLE mutex=NULL;
DWORD result=0;
mutex=CreateMutex(NULL,FALSE,"erlang3");
result=WaitForSingleObject(mutex,INFINITE);
t1=erl_format("{~i,~i,~i,~i,~i}",e1,e2,e3,e4,e5);
Result=erl_reg_send(sockfd, "enodereceiver", t1);
erl_free_compound(t1);
erl_eterm_release();
ReleaseMutex(mutex);
CloseHandle(mutex);
}

If the load is heavy then this function is rapidly called and at certain 
times we get a error saying unhandled exception. Later we debug and found 
that when erl_format is called that internally calls some memory alloc 
function and we get error in this point, also some times we get error 
exception in erl_reg_send(). we used function erl_eterm_statistics() to find 
the allocated and freed memory blocks and some times it shows that allocated 
block as -1. the attached image contains the call stack and watch values... 
during the debug..

Anything to be changed on the above code?
Please help.

regards,
Maruthavanan.S

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.GIF
Type: image/gif
Size: 46190 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050520/c8b1c166/attachment.gif>


More information about the erlang-questions mailing list