Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Updated 9-Dec-12 17:27pm
v2

1 solution

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.

—SA
 
Share this answer
 
Comments
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.
Sergey Alexandrovich Kryukov 9-Dec-12 23:38pm    
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...
--SA
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).
Sergey Alexandrovich Kryukov 10-Dec-12 1:16am    
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...
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900