Ok that makes sense. Thank you.

-----Original Message-----
From: "[email protected]" <[email protected]>
Sent: ‎4/‎3/‎2015 3:35 AM
To: "[email protected]" <[email protected]>
Subject: [julia-users] Re: Garbage collection when calling a function



On Thursday, April 2, 2015 at 10:51:52 PM UTC+11, Ali Rezaee wrote:
Dear all,

I have faced a situation that was unexpected to me. Would you let me know if 
this was expected or this is a bug?

I have a very long code, so I could not put an example here. But the situation 
is that I have a function in a separate file that I have included in my code. 
Some where in my code, I call the function for thousands of times, and each 
time it returns an integer, 0 or 1. The problem is that with each call of the 
function, memory usage of my pc increases by one percent and is not deallocated 
after the function is finished.
I could circumvent the problem by explicitly using the garbage collector gc(). 
Should Julia not have collected garbage automatically after a function from an 
external library has finished running?



The GC does not run every time a function returns, it runs when the memory 
usage reaches a specified amount (IIUC) so until your usage reaches the limit 
GC won't run.


Cheers
Lex


 

Many thanks

Reply via email to