garbage

Apache caching javascript assets?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 07:01:24
Not so long ago I was having trouble with javascript assets. When I made changes to them they wouldn't take effect and the file would become invalid javascript (firebug throwing errors and warnings). I noticed that my changes weren't appearing and special characters were being added to the end of the file. A bit more digging and I noticed that the special characters were exactly the number of characters of my edits. Original code: $(document).ready(function(){ alert('what'); }); Adding a line, should looks like this: $(document).ready(function(){ alert('what'); alert("what's going on?!); });

C# garbage collector seems to be closing my StreamWriter too early

故事扮演 提交于 2019-12-04 05:58:01
I have a logger class thats a singleton. In it's destructor I call Close() which prints the footer for the log and then closes the StreamWriter. public void Close() { WriteLogFileFooter(); _logFile.Flush(); _logFile.Close(); } The problem is when System.Enviornment.Exit(1) is called from elsewhere in the program (portions that I didn't write myself), the footer is never printed and my logger throws an exception for trying to write to a closed stream. I can only assume the Exit command is causing my StreamWriter to be closed before my Singleton is destructed. I tried to use GC.SupressFinalize()

C# Does Lambda => generate garbage?

懵懂的女人 提交于 2019-12-03 06:44:36
问题 Does using a lambda expression generate garbage for the GC opposed to the normal foreach loop? // Lambda version Foos.ForEach(f=>f.Update(gameTime)); // Normal approach: foreach (Foo f in Foos) { f.Update(gameTime); } The CLR profiler shows that I have 69.9% system.Action< T > and I suspect that being the lamba version of the foreach loop as above. Is that true? EDIT: I used the Microsoft CLR profiler: http://download.microsoft.com/download/4/4/2/442d67c7-a1c1-4884-9715-803a7b485b82/clr

C# Does Lambda => generate garbage?

雨燕双飞 提交于 2019-12-02 20:24:26
Does using a lambda expression generate garbage for the GC opposed to the normal foreach loop? // Lambda version Foos.ForEach(f=>f.Update(gameTime)); // Normal approach: foreach (Foo f in Foos) { f.Update(gameTime); } The CLR profiler shows that I have 69.9% system.Action< T > and I suspect that being the lamba version of the foreach loop as above. Is that true? EDIT: I used the Microsoft CLR profiler: http://download.microsoft.com/download/4/4/2/442d67c7-a1c1-4884-9715-803a7b485b82/clr%20profiler.exe or http://msdn.microsoft.com/en-us/library/ff650691.aspx Yes, a lambda will create garbage if

Object ready for Garbage collection, Java

不打扰是莪最后的温柔 提交于 2019-12-02 18:10:01
问题 From http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html#99740 example A3.3 says, it says that an object might still not be available for garbage collection even though it might be out of scope. IT is available only if the method is taked off stack. Now if we consider the following case: void foo(){ Dog a = new Dog(); Dog b = new Dog(); b=a while(true)//loop for long time } Will the object b referring to be available immediately for garbage collection, or only after

Will calling System.exit(0); from an object outside of main run garbage collection?

半世苍凉 提交于 2019-12-02 04:32:29
I plan to use an object which is called by my main method to exit the entire program. The object has a method which just runs a System.exit(0). My question is, is this a safe thing to do? If I run System.exit(0) from another object, will garbage collection still clean out the entire program from memory, or will I have issues cleaning the calling class from memory? My thoughts are that either since the JVM will be terminated, the calling class will be garbage-collected, or that I might have issues cleaning the calling class from memory since the object's stack frame is above the main stack

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

时间秒杀一切 提交于 2019-12-01 23:39:00
问题 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 explicitly set upon each entry. If they are not set, they will contain garbage Is it saying that for the following code, a will not contain garbage after the program finished its execution and if I declare a like this: int a; then a will contain garbage?

Getting Garbage Values while reading struct data from a binary file

久未见 提交于 2019-11-30 16:45:29
Hi guys in my previous question, I was able to get the data of a struct to be loaded on a file, but now the issue is I'm getting garbage value while retrieving it. File Contents: settings.bin 110#NormalCompression Level210#NormalCompression Level310#NormalCompression Level410#NormalCompression Level510#NormalCompression Level Code #include<cstdlib> #include<iostream> #include<string> #include<iomanip> #include<fstream.h> using namespace std; const char* ErrorLogFilePath = "resources\\error.txt"; const char* SettingsFilePath = "resources\\settings.bin"; const int NoOfSettings = 5; struct

iOS JSON Error: NSDebugDescription=Garbage at end

半城伤御伤魂 提交于 2019-11-29 15:30:27
This is a really weird bug, when grabbing JSON from my server (which is produced via PHP), I get this error when calling: json = [NSJSONSerialization JSONObjectWithData:kivaData options:kNilOptions error:&jsonError]; JSON Error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Garbage at end.) UserInfo=0x178467d00 {NSDebugDescription=Garbage at end.} My (NSData* kivaData) grabs everything perfectly, but it cant parse the JSON. I have run my JSON code in http://jsonlint.com/ and it comes out Valid everytime. Its really weird because it can

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

大兔子大兔子 提交于 2019-11-29 11:35:40
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 immediately received. Despite the program outputting that it successfully sent and received 5 characters for the chosen string ('Hello'), trying to print the contents of the buffer just produces one or two garbage characters. The program: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include