Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
QuestionForce CG Pin
Jammer13-May-09 9:43
Jammer13-May-09 9:43 
AnswerRe: Force CG Pin
Dave Kreskowiak13-May-09 9:55
mveDave Kreskowiak13-May-09 9:55 
GeneralRe: Force CG Pin
Jammer13-May-09 10:12
Jammer13-May-09 10:12 
GeneralRe: Force CG Pin
Dave Kreskowiak13-May-09 10:44
mveDave Kreskowiak13-May-09 10:44 
GeneralRe: Force CG Pin
Jammer13-May-09 10:49
Jammer13-May-09 10:49 
GeneralRe: Force CG Pin
Christian Graus13-May-09 11:18
protectorChristian Graus13-May-09 11:18 
GeneralRe: Force CG Pin
Dave Kreskowiak13-May-09 14:24
mveDave Kreskowiak13-May-09 14:24 
AnswerRe: Force CG Pin
Christian Graus13-May-09 11:15
protectorChristian Graus13-May-09 11:15 
I am CG. I think you want to force GC. Doing so, can make the number in the task manager lower, and while it's not accurate, WPF is also crap at this, you get no dispose methods and if you swap a lot of images, memory will leak and your app will crash.

Jammer wrote:
Microsoft seem to say leave it up to the CG to decide,


OK, well, no-one ever calls me, so I really don't get to decide at all.....

They say that, but it's a lie. In winforms, yes. WPF sucks, and it's just unavoidable that you need to do it yourself. In fact, I found recently that running 20 odd video thumbnails in repeat mode, never reloading them, would cause a memory crash pretty quick. It's a joke.

GC.Collect();
GC.WaitForPendingFinalizers();
SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1);

That's the magic code that I use. Without it, all my WPF apps would fail, for memory issues.

Christian Graus

Driven to the arms of OSX by Vista.

"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

GeneralRe: Force CG Pin
Jammer13-May-09 11:23
Jammer13-May-09 11:23 
GeneralRe: Force CG Pin
Christian Graus13-May-09 11:25
protectorChristian Graus13-May-09 11:25 
GeneralRe: Force CG Pin
Jammer13-May-09 11:41
Jammer13-May-09 11:41 
Questionhow to retrieve seconds, minutes and hours out of timer Pin
Aljaz11113-May-09 9:39
Aljaz11113-May-09 9:39 
AnswerRe: how to retrieve seconds, minutes and hours out of timer Pin
OriginalGriff13-May-09 9:52
mveOriginalGriff13-May-09 9:52 
QuestionHelp access image from the internet Pin
Alex_xso13-May-09 9:20
Alex_xso13-May-09 9:20 
AnswerRe: Help access image from the internet Pin
Dave Kreskowiak13-May-09 9:38
mveDave Kreskowiak13-May-09 9:38 
GeneralRe: Help access image from the internet Pin
Alex_xso14-May-09 8:21
Alex_xso14-May-09 8:21 
GeneralRe: Help access image from the internet Pin
Dave Kreskowiak14-May-09 17:51
mveDave Kreskowiak14-May-09 17:51 
QuestionHow does one have mdichildren forms automatically sized to fit the parent form? Pin
Lecutus113-May-09 9:06
Lecutus113-May-09 9:06 
AnswerRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
DaveyM6913-May-09 10:55
professionalDaveyM6913-May-09 10:55 
GeneralRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
Lecutus114-May-09 8:41
Lecutus114-May-09 8:41 
GeneralRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
DaveyM6915-May-09 4:38
professionalDaveyM6915-May-09 4:38 
QuestionSortedList, Key as element of Value Pin
Aaron Hartley13-May-09 8:37
Aaron Hartley13-May-09 8:37 
AnswerRe: SortedList, Key as element of Value Pin
OriginalGriff13-May-09 8:51
mveOriginalGriff13-May-09 8:51 
GeneralRe: SortedList, Key as element of Value Pin
Aaron Hartley13-May-09 9:40
Aaron Hartley13-May-09 9:40 
GeneralRe: SortedList, Key as element of Value Pin
OriginalGriff13-May-09 9:49
mveOriginalGriff13-May-09 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.