Questions tagged [garbage]

Garbage, refers to objects, data, or other regions of the memory of a computer system (or other system resources), which will not be used in any future computation by the system, or by a program running on it.

From a programming point-of-view, garbage is data that has been placed in random access memory space obtained from the operating system that is no longer needed. Freeing the space for reuse is called "garbage collecting".

448 questions
3
votes
1 answer

String.Format and garbage collection

In my ongoing investigation of high CPU usage in our application I have come to the conclusion that it's the GC taking up most of the CPU time. Looking at a memdump of the w3wp process (the app is iis hosted) I found something strange: there was a…
iCediCe
  • 1,672
  • 1
  • 15
  • 32
3
votes
3 answers

Possible to force an object to be garbage collected in Gen 1 or Gen 2 and not in Gen 0?

An interviewer asked me a weird question of which I couldn't find answer. Is it possible to force an object to be garbage collected in Gen 1 or Gen 2 and not in Gen 0?
Nikhil Agrawal
  • 47,018
  • 22
  • 121
  • 208
3
votes
1 answer

Ruby 2.1.5 - GC tuning

I have Ruby 2.1.5 installed on my server and need to configure GC tuning variables for the best/optimum Ruby performance. Following is the hardware/software information information: Memory - 7697604 KB (8GB) CPU - Intel(R) Xeon(R) CPU E5-2670 v2 @…
3
votes
3 answers

Garbage characters in string

I've written code to make a right pyramid out a character. However, when I execute the program, the last two lines of the pyramid have garbage characters placed after them even when it exceeds the size of the array. The code is here: #include…
TAC
  • 31
  • 4
3
votes
5 answers

number of objects for garbage collection

Given: interface Animal { void makeNoise(); } class Horse implements Animal { Long weight = 1200L; public void makeNoise() { System.out.println("whinny"); } } public class Icelandic extends Horse { public void makeNoise() {…
3
votes
4 answers

Why automatic variable will contain garbage if it is not set?

In 'The C programming language' third edition and on p.32 I saw those lines which make me confused: Because automatic variables come and go with function invocation, they do not retain their values from one call to the next, and must be …
Khanh Tran
  • 1,776
  • 5
  • 25
  • 48
3
votes
2 answers

Equivalent of /dev/null for writing garbage test data?

I need to perform a series of test for picking the fastest branch of code for a set of functions I designed. As this functions output some text/HTML content, I would like to measure the speed without filling the browser with garbage data. Is there…
Julio María Meca Hansen
  • 1,303
  • 1
  • 17
  • 37
3
votes
1 answer

Raspberry Pi UART program in C using termios receives garbage (Rx and Tx are connected directly)

I have a simple program written in C which uses termios to send a basic string to the Raspberry Pi UART and attempts to read and output the response. The Rx and Tx pins on the Raspberry Pi are connected with a jumper so whatever is sent should be…
kourosh
  • 41
  • 1
  • 2
  • 3
3
votes
4 answers

Garbage collection in C#; disposing of objects in a specific thread

To learn C# native interop, I've been working on an OpenGL wrapper. The OpenGL API itself is a state machine which is bound to a specific thread. When an object containing native resources is garbage collected, the finalizer is running in the GC…
jameswilddev
  • 582
  • 7
  • 16
3
votes
3 answers

Python security: Danger of uncollected variables out of scope

I have a method in a class which decrypts a variable, and returns it. I remove the returned variable with "del" after use. What is the danger of these garbage values being accessed...and how can I best protect myself from them? Here is the…
RightmireM
  • 2,381
  • 2
  • 24
  • 42
3
votes
2 answers

For Javascript game engines, is re-using a global variable more or less efficient than making locals?

A lot of Javascript performance guides tend to emphasize two points: Stay within scope; looking up variables progressively through each scope is expensive. Don't abuse the garbage collector by creating unnecessary variables constantly. For…
Josh
  • 1,997
  • 13
  • 21
3
votes
3 answers

Finalize() cleanup vs. Garbage Collector removing an object from memory

I was reading about the finalize() method and was curious: What is the difference between the task of cleaning up objects ( setting them to NULL ) in finalize, and removing an object from memory?
Chris Okyen
  • 529
  • 2
  • 6
  • 22
2
votes
4 answers

Trying to replicate printf behaviour about variadic paramenters

I'm trying to replicate some printf functionality for education purposes, but I've encountered some printf behavior that I'm unable to understand. I'll try explaining with a simple example: have this call: printf(" %c %c %c", 0, 1, 2); // yes,…
Lineath
  • 33
  • 4
2
votes
1 answer

Malloc or Calloc return unexpected values in string

I am trying to create a dynamic memory allocation string so which returns a string removing all vowels. In the beginning, some of the strings work correctly but suddenly some of them returns with an extra value which makes me fail the test, and I…
Raihan_Alam
  • 89
  • 2
  • 10
2
votes
1 answer

Weird characters appear at the end of file when encrypting it

I never thought I would have to turn to SO to solve this. Alright so for more insight I am making my own encryption program. I'm not trying to make it good or anything it's just a personal project. What this program is doing is that it's flipping…
Mr Fly
  • 33
  • 5