On Thursday, May 26, 2016 at 3:06:04 PM UTC, Chris Rackauckas wrote:
>
> I see mentions like this one every once in awhile:
>
> "D language is a special case, as it has GC, but it's also optional (as 
> with Julia)"
>

I've been saying something like this [and actually googled, it wasn't me..]

I may have been spreading misinformation, only recently understanding D 
better in what (better) sense GC is "optional" there:


D has GC by default, but better handling (@nogc) for being sure only manual 
memory allocation is allowed in a function (and I guess that function is 
disallowed to call a funtion not marked as such).

In D, if not all your functions are marked as such, then it's about as bad 
to disable the GC [for a long time] as doing so in Julia is.

There are two recent thread here on real-time and avoiding allocations.

You can use Libc.malloc and Libc.free directly in Julia (or call C and use 
manual memory management that way indirectly). That will only get you 
bytes, not objects.

You can use Ptr on those bytes and "reinterpret" (does it only allow some 
types, not "objects" in general?).. It's probably not easy(?) to work that 
way outside of the GC; I'm not sure what it involves using those bytes as 
objects to get it to be easier, except by letting the GC take over, just as 
it can with C allocated memory.


Maybe I should try harder to convince other people (and myself) that Julia 
works very well (even for non-hard real-time) just as it is with the GC 
enabled, including for games. I just like pointing out you have the same 
powers as C/C++ without (or with) calling C/C++.

Reference counting is predictably slow, and you can get an avalanche of 
deallocations. Not doing the deallocations/GC activity can be faster when 
it's not happening, but in the end you might have an even bigger avalanche 
with naive variants of GC (I guess in 0.3), but not an avalanche in 
incremental as in 0.4.


Interesting quote from Oscar: "Interestingly a lot of games actually have a 
tracing gc that handles some objects,[..] or even because they have a C++ 
gc (I'm looking at you Unreal Engine)."

I know about GC e.g. with Lua, with games engines, but not within game 
engines/C++ actually being used, even though I know of the possibility: 
Boehm-style GC optional in C/C++ (even allowed by the C++ standard):

https://github.com/ivmai/bdwgc


[Love this quote from Jeff, just hadn't thought of it that way: 
"Overwriting data is a form of manual memory management (you're saying you 
don't need the old 
version of the data any more). In Julia folks get speedups from this all 
the time."]


Reply via email to