The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
2answers
207 views

Do immutable objects that constantly change impact memory/performance?

I'm writing a program that goes into a loop and keeps changing the state of some models (similar to a game). Naturally, many things are mutable. However, I'm also writing some classes that are ...
40
votes
7answers
3k views

Why is the finalize method included in Java?

According to this post, we should never rely on the finalize method to be called. So why did Java include it in the programming language at all? It seems like a terrible decision to include in any ...
2
votes
1answer
198 views

C# server side application 100 GB dataset + Garbage Collection

If I have server with 256 Gb of ram. I was wondering can I create a C# application which has a 100 GB of memory footprint? I want to create a dictionary like ...
1
vote
0answers
51 views

How can I find the start of a native method?

For a hobby project, I'm writing an x86 GC and JIT. For the GC, I need to maintain information about the stack layout (it's a precise GC), for which I need to be able to find out which method the IP ...
0
votes
1answer
118 views

Why/how does Java use a controlled mechanism to pause threads for GC?

I know that Java uses a controlled mechanism to allow threads to be paused. If I understood correctly, they put a read from a protected page at the end of e.g. loops, and change the protection of that ...
4
votes
5answers
475 views

Why is there no deterministic object destruction in Java? [duplicate]

I understand and enjoy the benefits of the Garbage Collection in Java. However I don't understand why there is no way in Java to explicitly (and quickly) destroy an object. Surely this could be useful ...
2
votes
2answers
136 views

Does a vm implemented in garbage collected language need a garbage collector?

This is more of a theoretical question. If jvm is implemented in go which itself is a garbage collected language, then does that jvm need a separate garbage collector to be implemented for its own ...
-1
votes
2answers
146 views

Is it possible to implement a native compiler for a 'managed language' such as Java?

In most cases, it is possible to create both a native compiler and an interpreter for a programming language. The compiler would simply convert the source code to machine code, and the interpreter ...
13
votes
3answers
1k views

Would using a hash table in garbage collection solve the stop the world problem of mark and sweep?

In mark-sweep-compact garbage collection algorithm you have to stop-the-world when relocating objects because reference graph becomes inconsistent and you have to replace values of all references ...
0
votes
4answers
321 views

How to design an IDisposable that unconditionally needs to be disposed?

Consider a class that implements IDisposable, and that has members in such a way that it will never become eligible for garbage collection when it is not disposed. And as it will not be garbage ...
25
votes
7answers
2k views

Disadvantages of scoped-based memory management

I really like scope-based memory management (SBMM), or RAII, as it is more commonly (confusingly?) referred to by the C++ community. As far as I know, except for C++ (and C), there's no other ...
3
votes
5answers
601 views

What exactly is the Garbage Collector in Java?

I think I generally know what the Garbage Collector in Java does, but It's praised a lot, so I thought maybe I'm missing something about it's functionality. What I know is, that the GC takes care of ...
3
votes
2answers
149 views

What use is a non-zeroing weak reference?

When reading about the various options for working with things like ARC / GC, I often come across explicit wording about which weak references are zeroing (ie, your reference becomes nil/null/0 when ...
7
votes
5answers
987 views

Why did the team at LMAX use Java and design the architecture to avoid GC at all cost?

Why did the team at LMAX design the LMAX Disruptor in Java but all their design points to minimizing GC use? If one does not want to have GC run then why use a garbage collected language? Their ...
7
votes
4answers
625 views

Why not free memory as soon as its reference counter hits zero [duplicate]

A lot of languages like Java and C# have garbage collectors that free memory when that memory no longer has any reference. Yet they don't immediately free it after the reference counter hits zero but ...
2
votes
1answer
219 views

Python garbage collection giving me a hard time

Context: I am developing a web application using webapp2 web-framework with python to be hosted on GAE. The web application (web-app from now on), is a chess variant. Being a first timer, I have ...
-2
votes
1answer
97 views

In what language could I track reference counting in the simplest and safest way? (Or track existing reference counting?) [closed]

I want to count references of objects, just like you would with (some) garbage collection, but all I want to do is turn this into a graph dataset that I can then analyze or visualize. What language, ...
0
votes
1answer
108 views

Multiple Instantiate of 1 class affects memory?

I am currently struggling with memory handling. I have an if statement and each case instantiate a new object from a class. Does this affect the memory allocation in java? switch() { case 1: test t1 ...
12
votes
2answers
1k views

Since Garbage Collection is non-deterministic, why isn't it used for secure random number generation?

I get that /dev/random is a good source of entropy, and is what is usually used-- It's just as I'm reading up on GC, at least in Java, it seems accepted that the garbage collection daemon executes ...
30
votes
2answers
3k views

Why are reference-counting smart pointers so popular?

As I can see, smart pointers are used extensively in many real-world C++ projects. Though some kind of smart pointers are obviously beneficial to support RAII and ownership transfers, there is also a ...
1
vote
3answers
197 views

Garbage collectors and pointers/ reference

I am a little confused on both pointers and reference. From my understanding pointers are addresses in memory. If I pass a variable using pointers and reference to a function, any manipulations of ...
6
votes
6answers
554 views

Demonstration of garbage collection being faster than manual memory management

I've read in many places (heck, I've even written so myself) that garbage collection could (theoretically) be faster than manual memory management. However, showing is a lot harder to come by than ...
2
votes
1answer
366 views

Are C or C++ The Only Viable Languages for a GC

Background I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting ...
25
votes
3answers
2k views

Except garbage collector, what else makes Java a non real time programming language

Except the garbage collector, what are some other features in Java that make it unsuitable for real time programming? On the net, whenever Java vs C++ is discussed with regards to real time ...
9
votes
3answers
378 views

Is Non-Deterministic Resource-Management a Leaky Abstraction?

From what I can see, there are two pervasive forms of resource-management: deterministic destruction and explicit. Examples of the former would be C++ destructors and smart pointers or Perl's DESTROY ...
14
votes
1answer
264 views

When a garbage collector compacts objects in the heap, does it change the references on the stack?

This seems like a simple question, but after a lot of reading on the subject, I still haven't found a definitive answer (perhaps because it is so simple). My question is this: when a garbage ...
8
votes
2answers
257 views

How does a concurrent garbage collector deal with variables?

Let's say it is a concurrent mark-and-sweep garbage collector. When such GC handles constant pointers it just walks through them (starting from roots), and marks every encountered data block. Then ...
18
votes
4answers
7k views

When to use weak references in .Net?

I have not personally come across a situation where I've needed to use WeakReference type in .Net, but the popular belief seems to be that it should be used in caches. Dr Jon Harrop gave a very good ...
3
votes
2answers
697 views

Memory management for fast message passing between threads in C++

Suppose there are two threads, which communicate by asynchronously sending data messages to each other. Each thread has some kind of message queue. My question is very low level: What can be expected ...
2
votes
1answer
167 views

Is it appropriate to try to control the order of finalization?

I'm writing a class which is roughly analogous to a CancellationToken, except it has a third state for "never going to be cancelled". At the moment I'm trying to decide what to do if the 'source' of ...
5
votes
4answers
917 views

Which part of the Memory is used for the Garbage Collector?

I understand the Heap memory divisions such as Young, tenured and Perm Gen. But I'm just curious from where is the memory used for performing the Garbage Collector itself? Is it from any of these ...
14
votes
6answers
683 views

How does a garbage collector prevent the whole memory from being scanned on every collect?

Some (at least Mono's and .NET's) garbage collectors have a short term memory area which they scan often, and a secondary memory area which they scan less often. Mono calls this a nursery. To find ...
3
votes
2answers
792 views

What degree of low-level programming can be achieved with Languages like Go?

Go and D provide garbage collection, and yet they claim to be system programming languages. What degree of low-level programming can be achieved with languages having garbage collection? For ...
10
votes
6answers
2k views

Should java developers know about garbage collection algorithms?

I have been recently asked in an interview if I know about any garbage collection algorithms. I knew what garbage collection is but I never really thought about learning about garbage collection ...
8
votes
7answers
928 views

Entry level engineer question regarding memory management

It has been a few months since I started my position as an entry level software developer. Now that I am past some learning curves (e.g. the language, jargon, syntax of VB and C#) I'm starting to ...
2
votes
1answer
666 views

How the Erlang get soft-realtime with GC?

Generally GC is not a good choice to get a soft real-time attribute. But Erlang is GC based language can be soft real-time. Does it mean Erlang have almost no GC latency? How does it work?
20
votes
3answers
2k views

Do all functional languages use garbage collection?

Is there a functional language which allows to use stack semantics - automatic deterministic destruction at the end of the scope?
8
votes
2answers
709 views

Why don't mobile platforms support generational garbage collection?

Both Windows Phone/Xbox and Android lack support for generational garbage collection. This is frustrating for a lot of programmers. There seems to be a legitimate engineering reason to it, but I can't ...
12
votes
8answers
903 views

What are the complexities of memory-unmanaged programming?

Or in other words, what specific problems did automated garbage collection solve? I've never done low-level programming, so I don't know how complicated can freeing resources get. Update - apologies ...
3
votes
3answers
268 views

Are tree structures inherently bad for mark-and-sweep garbage collector performance?

I'm implementing a bounding volume hierarchy in F#. Since it would be for a game, I want the garbage collector to be as quick and infrequent as possible. It seems though that I may have to pull some ...
2
votes
6answers
579 views

How assertive should I be in handling exceptions in objects?

I have been writing in C# 4.0 a lot lately and trying to write as lean as possible. As such, I have not been using the classic try/catch blocks and using statements as often. I understand the general ...
8
votes
10answers
1k views

Is garbage collection necessary? [duplicate]

Do any languages really need garbage collection? Is there not a way to figure out when a object should be destroyed? I haven't had leaks in C++ and i dont use smart pointers or reference counters or ...
28
votes
15answers
12k views

Why do languages such as C and C++ not have garbage collection, while Java does?

Well, I know that there are things like malloc/free for C, and new/using-a-destructor for memory management in C++, but I was wondering why there aren't "new updates" to these languages that allow the ...
17
votes
7answers
2k views

Why does Garbage Collection only sweep the heap?

Basically, I've learned so far that garbage collection erases forever any data structure that is not currently being pointed to. But this only checks the heap for such conditions. Why doesn't it also ...
11
votes
2answers
701 views

Is there a need for garbage collection in a stack-based language?

What is the need for garbage collection (GC) in a stack-based language? In a language like Forth or RPL (on HP calculators), is there a need for garbage collection? I would think, since output is ...
12
votes
4answers
920 views

What are the algorithms behind low pause GC?

Some languages, for exemple java, introduced a low pause GC. Those GC can do most of the work without pausing the whole world. This is obviously a quite hard problem because it require to analyze the ...
3
votes
2answers
382 views

Best refresher material on Java Garbage Collection? [closed]

I haven't looked at Java Garbage Collection for a while and feel the need for a refresher on it. Anyone recommend a resource or two?
4
votes
8answers
1k views

How common are circular references? Would reference-counting GC work just fine?

How common are circular references? The less common they are, the fewer hard cases you have if you are writing in a language with only reference counting-GC. Are there any cases where it wouldn't ...
26
votes
9answers
5k views

Why Garbage Collection if smart pointers are there

These days, so many languages are garbage collected. It is even available for C++ by third parties. But C++ has RAII and smart pointers. So what's the point of using garbage collection? Is it doing ...