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
2
votes
1 answer

Enum Extension generating garbage

I have the following; public static bool Has(this System.Enum type, T value) where T : struct { return (((int)(ValueType)type & (int)(ValueType)value) == (int)(ValueType)value); } For some reason, calling this extension method is generating…
LightStriker
  • 19,738
  • 3
  • 23
  • 27
2
votes
6 answers

how to get rid off garbage in array of chars?

I'm writing a C program but I keep having problems with my array of chars. I keep getting garbage when I print it using prinf. here is an example of what I get when I print it: char at t.symbol is Aôÿ¿ char at tabl[0].symbol is A char at…
fang_dejavu
  • 625
  • 2
  • 15
  • 22
2
votes
2 answers

Memory leaks in Delphi app. How to properly dispose objects and strings?

My question is about debugging memory leaks which seem to be a nightmare. In my app there is a simple class derived from TObject. All objects of that class are stored in a collection/list of of the class derived from TObjectList: type TOffer =…
Interface Unknown
  • 713
  • 10
  • 26
2
votes
5 answers

why garbage value is stored during declaration?

I heard several times that if you do not initialise a variable then garbage value is stored in it. Say int i; printf("%d",i); The above code prints any garbage value, but I want to know that what is the need for storing garbage value if…
kevin gomes
  • 1,775
  • 5
  • 22
  • 30
2
votes
1 answer

Javascript repeated use of "new" with same target variable

I think this is OK but I would like confirmation. In Javascript can I repeatedly assign a new object to the same variable without causing memory leaks or other problems? Example: var rect = new Rectangle(left1, top1, width1, height1); ... ... ... //…
boingy
  • 21
  • 2
2
votes
1 answer

Java Runtime getting a Garbage option error

i want to search for certain process through my java app so that i can verify if my app is running (Apache). here is a simplification of the class. package com.tecsys.sm.test; import java.io.BufferedReader; import java.io.IOException; import…
user2548720
  • 109
  • 2
  • 2
  • 7
2
votes
1 answer

Array dropping values, picks up garbage

After putting values into my array, one step later (thanks gdp) the array contains garbage. The only step afterwards is passing parameters to a function: struct Vertex; typedef struct Vertex Vertex; struct Vertex { int sides[2][LENGTH]; int…
2
votes
4 answers

Unexpected output of printf

int a=5; float b=3.5; printf("%d",b); printf("\n%f",a); Can anyone please tell me why this code is showing unexpected output (garbage\n3.5)
2
votes
5 answers

Java, make sure objects are being deleted when removed from arrayList

Lets say that I'm deleting a "dead" object called "Enemy". Using something like this: for(int i = 0; i < enemies.size(); i++) { Enemy en = (Enemy) enemies.get(i); if(en.getVisible() == true) en.update(); else …
ANZ
  • 21
  • 3
2
votes
2 answers

How to remove question mark garbage data, dynamically, from files?

I have an unknown number of files with garbage data interspersed and I want to remove said garbage data dynamically, perhaps using regex. It'll usually look something like this in an HTML file in a browser: this is the beginning of the file,…
user717236
  • 4,959
  • 19
  • 66
  • 102
2
votes
1 answer

Qt: Is is possible to get the QScriptEngine from QWebFrame?

I need to get access to the javascript QScriptEngine in a QWebFrame. Is that possible? Well, at least I think I need access to it. In response to a javascript call I need to allocate a new object, return it to javascript and hand ownership of the…
Alex Brown
  • 295
  • 3
  • 7
2
votes
1 answer

Java Garbage Collector Logic Query

A quick question about the Java Runtime Garbage Collector. Take this scenario: Two Objects both hold a reference to the other. No other Objects hold any reference to these Objects. The Objects are not doing anything - they're not Runnables, if they…
user1429224
2
votes
1 answer

Map allowing to putIfAbsent without creating the value when key already exists

I'd like to use a map that would be equivalent to ConcurrentMap (I want the equivalent of the putIfAbsent method) but that would not force me to create the object beforehand. For example when I do this: m.putIfAbsent( key, new CyclingArray() ); I…
Cedric Martin
  • 5,945
  • 4
  • 34
  • 66
1
vote
3 answers

Unix grep command outputs garbage

I´m executing the following command "grep bruno < bash.txt " which gives me the right output "bruno" and garbage "\f0\fs24 \cf0". I´m on the command shell on a Mac OS X v10.6.8 and i´m pretty sure i should be getting the line of the found word and…
bruno
  • 2,154
  • 5
  • 39
  • 64
1
vote
5 answers

Playing with char array

Is that safe to do something like this: char* charArray = new char[10]; strcat(charArray, "qwertyuiop"); charArray[3] = '\0'; delete [] charArray; Will everything be deleted? Or that what is after \0 won't be? I don't know if I'm leaving…
user1112008
  • 432
  • 10
  • 27