[erlang-questions] problem with pread,recursrsive func

Bengt Kleberg bengt.kleberg@REDACTED
Mon Apr 20 08:29:23 CEST 2009


Greetings,

If it is ok with you I will interpret your statement about flushing
buffer to mean force garbage collect. If that is what you want to do,
please try to add:
erlang:garbage_collect()
after sending to UDP, before the call to read/2 


If you want more help it would be nice if you could send more of the
real code. Not all of it, of course.


bengt

On Sat, 2009-04-18 at 10:37 -0700, sandeep_k wrote:
> I has written a plug in tsung which read data from file and send though UDP
> Socket 
> But when I crated 10 users per sec with 30 sec it is taking full memory  
> when commented  pread it is working properly  
> How to avoid this problem , is this problem due to recursive function ?
> How to flush for Data buffer ?
> 
> Read_send(Fd,Offset) ->
> Case 	File:pread(Fd,Offset,4096) of
> 	{ok,Data} ->
> 		I am send data using UDP socket
> 		NewOffset=Offset+4096,
> 		I will recursively call this function till 20Mb file is read 
> 		Read(Fd,NewOffset);
> 	_ ->
> 		Error
> end
> 




More information about the erlang-questions mailing list