News for hackers. Stuff that matters.
Re:Nimrod by Example by charlieflowers on Thursday July 17, 2014 @12:08PM (#8048291)
Still, there are times when GC is fine for a particular application. In those cases, Nimrod is pretty fantastic, especially given its metaprogramming capabilities.
Re:Nimrod by Example by def- on Thursday July 17, 2014 @12:10PM (#8048298)
Also, the GC can be controlled, so you can set exactly when it is allowed to run, something like this for a game:

  gcDisable()
  while true:
    gameLogic()
    renderFrame()
    gcStep(us = leftTime)
    sleep(restTime)
http://nimrod-lang.org/gc.html
Re:Nimrod by Example by FnuGk on Thursday July 17, 2014 @12:33PM (#8048485)
Then what happens if the GC keeps taking longer than the allowed time? Will it then not keep allocating more and more memory that will never be freed?
Re:Nimrod by Example by mcguire on Thursday July 17, 2014 @02:08PM (#8049144)
Likely, yes. (Welcome to real-time programming; if you don't keep track of your time-budget, you're gonna have a bad day.)

I haven't looked at Nimrod's GC, but I believe it's indeed incremental; it won't take more time than you give it, but it will leave things uncollected if you don't give it [enough] time.

Re:Nimrod by Example by sitkack on Thursday July 17, 2014 @10:54PM (#8051448)
in a game, detect gc pressure and schedule some slo mo candy to use as gc cover.
Re:Nimrod by Example by def- on Thursday July 17, 2014 @12:38PM (#8048521)
I guess so. This is only viable if you have enough time for garbage collection.
Re:Nimrod by Example by camperman on Thursday July 17, 2014 @01:14PM (#8048810)
Nimrod's pointers to garbage collected memory are separate from the pointers you can allocate yourself. So you could do manual memory management on the parts that really need it - say for a game in a tight loop - and leave the collector to worry about the smaller and less time-critical stuff.

Also the GC is only triggered on a memory allocation. It doesn't run in a background thread or anything like that. So if the GC fails, then the allocation of memory fails (as I understand it) which means your scenario would be caught early.

Re:Nimrod by Example by Dewie on Thursday July 17, 2014 @02:13PM (#8049178)
> Nimrod's pointers to garbage collected memory are separate from the pointers you can allocate yourself.

Does this mean that they use different heaps?

Re:Nimrod by Example by flaviu1 on Thursday July 17, 2014 @02:48PM (#8049393)
No, they are on the same heap since the GC isn't a moving collector.
Re:Nimrod by Example by eudox on Thursday July 17, 2014 @02:37PM (#8049324)
They probably use the same heap underneath.