473,787 Members | 2,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to handle memory allocation i shared hosting environments? (GC.Collect)

Hi, a customer is using our fairly memory intensive web app. in a
shared hosting environment
and the other day their host 'banned' (I think they just killed the
process) them for memory abuse.

Our app. has been profiled with SciTech's Mem Profiler, and it seems
that some of the issues relate to .NET bugs, but are alleviated by use
of System.GC.Colle ct(). I'm under the impression that it's generally
bad form to call this yourself, but at the same time, it strikes me
that the GC probably doesnt realise it's in a shared hosting
environment and there is happy to use up as much memory as it likes.
Possibly the host could do a better job of configuration(? ), but that
doesnt really help much since we can't go around telling customers to
tell their hosts to sort out their config -> good way to lose a
customer.

So question is; what are the cons of calling Collect(), are they just
speed related?

Any tips would be welcome

Thanks
Jim

Jun 12 '06 #1
3 1381
I say go ahead and call GC.Collect sparingly. That's why it's there.
It does use significant CPU cycles so don't call it very often or it could
degrade performance.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<jd*******@gmai l.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
Hi, a customer is using our fairly memory intensive web app. in a
shared hosting environment
and the other day their host 'banned' (I think they just killed the
process) them for memory abuse.

Our app. has been profiled with SciTech's Mem Profiler, and it seems
that some of the issues relate to .NET bugs, but are alleviated by use
of System.GC.Colle ct(). I'm under the impression that it's generally
bad form to call this yourself, but at the same time, it strikes me
that the GC probably doesnt realise it's in a shared hosting
environment and there is happy to use up as much memory as it likes.
Possibly the host could do a better job of configuration(? ), but that
doesnt really help much since we can't go around telling customers to
tell their hosts to sort out their config -> good way to lose a
customer.

So question is; what are the cons of calling Collect(), are they just
speed related?

Any tips would be welcome

Thanks
Jim

Jun 12 '06 #2
if GC.Collect() helps, then you probably are not calling Dispose() when you
are supposed to, so you are not releasing unmanged memory as early as
possible.

If you are using com interop, then you probably are not releaseing the com
objects with calls to ReleaseComObjec t, or are using double dot notion
(myobject.a.b) which will cause excessive use of memory (again the com
object is not dereferenced when done, so it hangs on to unmanaged memory)

-- bruce (sqlwork.com)
<jd*******@gmai l.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
Hi, a customer is using our fairly memory intensive web app. in a
shared hosting environment
and the other day their host 'banned' (I think they just killed the
process) them for memory abuse.

Our app. has been profiled with SciTech's Mem Profiler, and it seems
that some of the issues relate to .NET bugs, but are alleviated by use
of System.GC.Colle ct(). I'm under the impression that it's generally
bad form to call this yourself, but at the same time, it strikes me
that the GC probably doesnt realise it's in a shared hosting
environment and there is happy to use up as much memory as it likes.
Possibly the host could do a better job of configuration(? ), but that
doesnt really help much since we can't go around telling customers to
tell their hosts to sort out their config -> good way to lose a
customer.

So question is; what are the cons of calling Collect(), are they just
speed related?

Any tips would be welcome

Thanks
Jim

Jun 12 '06 #3
bruce barker (sqlwork.com) wrote:
if GC.Collect() helps, then you probably are not calling Dispose() when you
are supposed to, so you are not releasing unmanged memory as early as
possible.

I wish that were the case, but no, it's a 'bug' in the framework

http://dturini.blogspot.com/2004/06/...with-some.html

calling Collect helps keep the total usage down (according to my
profiler).
Jim

Jun 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3378
by: Koen | last post by:
Hi! What is the method you use to handle memory allocation failure in C++ using the "new" operator? I used to only check if a NULL pointer is returned after the "new" call, but that's probably only working in MSVC++. I also read about the "bad_alloc" exception, but that doesn't seem to be thrown by MSVC++. Now, one could of course say "don't use MSVC++", but I'd rather like to hear a good solution for being able to handle memory...
13
2339
by: Erick Papadakis | last post by:
hello, i am a newbie to the pgsql world, so pls bear with a possibly stupid question. i want to test out pgsql but i only have a shared hosting account. is it possible to install pgsql without root access, only for my account? my webhost uses redhat i think. thanks! ..ep
0
1396
by: Chris Travers | last post by:
Hi all; This seems at least somewhat on-topic here, so at the risk of seeming shamelessly self-promoting, I figured I would ask. I am the main developer of an open source CRM suite (http://hermesweb.sourceforge.net). We are in the beta-testing of our 0.3.0 release which will include experimental support for shared hosting environments. I would be interested in helping any interested parties beta test the software. Any feedback...
2
9671
by: mghale | last post by:
Greetings, I have moved a database from the DB2 Windows Platform (Dev) to our production AIX Server and am experiencing an issue: The AIX platform is 5.3 and DB2 version 8.1 pixpack 9a (8.1.1.89) There hardware is Power5 8 procs, 4 online and 8 GB of memory. When I create the the database with the 8 bufferpools that existed in DB2 Windows, then try to connect to the database, I receive an error
3
1478
by: EasyKev | last post by:
We have been trying to upgrade all our C++ projects from VC6 to VS .Net2003 for a while (before VS 2005 arrived), and seem to be stuck now because of the performance degradation seen for the same code when compiled by the new compiler compared to being compiled by VC 6 compiler. Originally we thought it was the STL libraries that had killed all performance but it seems to be a general memory allocation problem in VS .Net 2003 (and also in...
3
6045
by: chris.mcinnes | last post by:
G'day, Got a bizzare issue with PHP 5.0.2/Apache constantly generating variations of the following error: "Fatal error: Possible integer overflow in memory allocation" At first I traced it through to any line using the $_SERVER command and so replaced it with $HTTP_SERVER_VARS.
66
3644
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if (function(socket, args) == -1) { perror("function"); exit(EXIT_FAILURE); } I feel that the ifs destroy the readability of my code. Would it be
2
1957
by: Carl Gilbert | last post by:
Hi I feel as if I'm fighting a loosing battle with shared hosting at the moment. I have an account with 1&1. For a whopping £16.99 a month I get 6GB of shared Microsoft hosting. I also get the ability to have as many domains as I like, 5 web applications and large SQL databases. I'm currently experiencing some difficulties with a website. "Request for the permission of type
0
1689
by: Le Minh | last post by:
I used this class to dynamic memory allocation: using System; using System.Runtime.InteropServices; public unsafe class Memory { // Handle for the process heap. This handle is used in all calls to the // HeapXXX APIs in the methods below. static int ph = GetProcessHeap(); // Private instance constructor to prevent instantiation. private Memory() {}
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.