Click here to Skip to main content
13,593,097 members
Rate this:
Please Sign up or sign in to vote.
As the title says! can I force a method/function to run on an other process without going too much into assemblies/decompiling etc.?

I'm having a app that is in need of doing some very heavy memory work with some graphic objects using GDI+, (up to ½-1 GB) so I want to have this to run in a process alone since I keep getting out of memory exceptions when running in my app's "main" process. I've tried to play around with allocating more memory but it doesn't seems to work, and also tried to use GC.Collect(2); which helped a little but not enough for the method to complete the work wished.

Simple code and finger points would be most appreciated!!! - Thanks
Posted 9-Dec-12 16:57pm
Updated 9-Dec-12 17:27pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no such thing as "force" to run something to "run on a single process". Processes are totally under your control. If you don't create a process, it is not created by anything by itself. And using GC is not recommended.

Your "without going too much into assemblies and stuff like that" sound demanding and arrogant, sorry. You are supposedly developing in .NET, where the assembly is a central object and notion. It looks like you do not understand the essence of things here. To get more help, you need to be more specific and share your ultimate goal. Only then you can get valuable advice even if you are going in wrong direction.

Jackie00100 9-Dec-12 23:34pm
Improved/edited a little, I'm sorry, didn't reread it before post, was kinda dumb of me, what i meant was that i want to split the app up in multiple processes, but the new process should only run a single wished method and then exit then it's done. I've seen some uses appdomains and methodinfo, but i try to keep it simple but still strong, and i know from previously experience that assemblyinfo and appdomains etc. is not too fun to play around with.

Of cause i know everything needs a process to run and i know the you shouldn't poke to much to the garbage collector. as said earlier, even that it sounds arrogant, i'll try to avoid to use these simply to keep it simple and i personally don't like to work with it, so it is a "last call" if no one else could give any suggestions.

hope this makes some clarification.
What such split can give you? You can split into threads, not processes; and, if this is just about workload, it can help only if you have multiple CPUs or CPU cores, otherwise you will only loose performance as threading has its overhead (albeit much less than in case of separate processes).

Please understand: processes are isolated, they are really designed to be a single application...
Jackie00100 9-Dec-12 23:45pm
it's more about memory management since i'm getting out of memory exceptions when generation these large images, and the app is running at 1,5 GB (arcording to the task manager) and I've heard there is a way to split the app into multiple processes (yet something i have to learn) like a browser have a process for each open tab/url/fan (not sure what it's called in english).
Why different processes or even threads then? Memory is memory; if you need it, you need it. Splitting cannot help you. If you explained more of the background, you could get some specific design advice...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.180618.1 | Last Updated 9 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100