Thanks for the reply.  A couple questions:

1) When I quit Julia and do a fresh start, is the tally set to zero?
2) When GC does a pass, does it clear out everything so the tally is set to 
zero, or does it do a partial clearance?
3) I presume it is the latter case in question 2).  So does GC clear out 
things on first-in-first-out bases or what?
4) When the tally becomes big enough, does GC make sure to keep objects 
that are referenced for future use in (Julia) code?
5) Do local objects (things allocated and only used within functions for 
instance) get cleared out immediately when the functions terminate so they 
don't take up quota in the tally?

On Sunday, September 11, 2016 at 12:16:05 AM UTC+8, Tim Holy wrote:
>
> Every time julia allocates memory, it adds the number of bytes to a 
> running tally; once that tally gets big enough, it does a 
> garbage-collection pass (and resets the tally). Consequently GC is 
> triggered only when you allocate, but even the smallest allocation can 
> trigger GC if it pushes the tally over the threshold. It thus depends on 
> where that tally was when you started. Keep in mind that there are many 
> uses of memory that may not be obvious; for example, JIT compilation uses 
> memory because julia code is compiled by julia code.
>
>  
>
> Best,
>
> --Tim
>
>  
>
> On Saturday, September 10, 2016 7:05:18 AM CDT K leo wrote:
>
> > Let's say in REPL you define an object, then after many many other
>
> > operations, Julia's GC wouldn't free the object you defined earlier until
>
> > you exit Julia or you somehow really run out of memory or something. Is
>
> > that the correct understanding?
>
> > 
>
> > Now I am trying to think what happens with the jl_... calls one performs
>
> > from C/C++ code. The procedure is that one calls jl_init first to start a
>
> > Julia session, then a bunch other jl_... calls to handle some data, and
>
> > then at last jl_atexit_hook to stop using Julia. Is the mechanism here
>
> > similar to REPL in the sense that the Julia session is up and running
>
> > before one calls jl_atexit_hook? So Julia GC would not free objects you
>
> > created with jl_... calls until you exit or you somehow really run out of
>
> > memory or something.
>
> > 
>
> > Having read the section in Embedding Julia, I get the sense that it is 
> the
>
> > case. So we only need to worry about GC after all jl_... calls, not in
>
> > 
>
> > between jl_... calls. So here it says :
>
> > > “However, it is generally safe to use pointers in between jl_... calls.
>
> > > 
>
> > >> But in order to make sure that values can survive jl_... calls, we 
> have
>
> > >> to
>
> > >> tell Julia that we hold a reference to a Julia value. ”
>
> > > 
>
> > > Excerpt From: unknown. “Julia Language 0.6.0-dev documentation.” 
> iBooks.
>
> > > 
>
> > > Is my understanding correct? Or can anyone please explain otherwise?
>
>  
>
>  
>

Reply via email to