Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage:
Program code is shared between multiple instances of the same program.
Shared library program code is shared between all processes that use that library.
Some apps fork off ...
Although I do understand the serious implications of playing with this function (or at least that's what I think), I fail to see why it's becoming one of these things that respectable programmers wouldn't ever use, even those who don't even know what it is for.
Let's say I'm developing an application where memory usage varies extremely ...
Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory.
So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?
...
Suppose you have a fairly large (~2.2 MLOC), fairly old (started more than 10 years ago) Windows desktop application in C/C++. About 10% of modules are external and don't have sources, only debug symbols.
How would you go about reducing application's memory footprint in half? At least, what would you do to find out where memory is consu...
I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows Service to do some processing, and I'm looping through a large amount of data that I'm pulling back from the context. Yes - I know I could do this with a stored procedure but there are reasons why that would be a less than ideal solution.
An...
Back in the olden days, there were tricks used (often for blitting offscreen framebuffers), to copy large chunks of memory from one location to another.
Now that I'm working in C#, I've found the need to move an array of bytes (roughly 32k in size) from one memory location to another approximately 60 times per second.
Somehow, I don't ...
I need to keep as much as I can of large file in the operating system block cache even though it's bigger than I can fit in ram, and I'm continously reading another very very large file. ATM I'll remove large chunk of large important file from system cache when I stream read form another file.
...
Consider this case:
dll = LoadDLL()
dll->do()
...
void do() {
char *a = malloc(1024);
}
...
UnloadDLL(dll);
At this point, will the 1k allocated in the call to malloc() be available to the host process again?
The DLL is statically linking to the CRT.
...
I wrote C++ for 10 years. I encountered memory problems, but they could be fixed with a reasonable amount of effort.
For the last couple of years I've been writing C#. I find I still get lots of memory problems. They're difficult to diagnose and fix due to the non-determinancy, and because the c# philosophy is that you shouldn't have to...
Suppose I have the following code:
while(TRUE) {
pthread_t *thread = (pthread_t *) malloc(sizeof(pthread_t));
pthread_create(thread, NULL, someFunction, someArgument);
pthread_detach(*thread);
sleep(10);
}
Will the detached thread free the memory allocated by malloc, or is that something I now have to do?
...
For example:
char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE);
free(myString);
free(myString);
Are there any adverse side effects of doing this?
...
I've never developed a web application that uses distributed memory.
Is it common practice to run a tool such as Microsoft Velocity on my local machine as I develop, should I run Velocity on another server as I develop, or should I just develop as normal (default session & cache) and use Velocity only after I've deployed to our develop...
Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr, and associated containers (CAutoPtrArray, CAutoPtrList, etc.).
Does the CAutoPtr class implement reference counting?
...
Has anyone tried to use MS Velocity with NHibernate.
I've seen that NHibernate can use NCache as a distributed cache, but I am more interested in using MS Velocity instead.
Are you aware of Cache Provider for MS Velocity for NHibernate?
...
Ruby is truly memory-hungry - but also worth every single bit.
What do you do to keep the memory usage low? Do you avoid big strings and use smaller arrays/hashes instead or is it no problem to concern about for you and let the garbage collector do the job?
Edit: I found a nice article about this topic here and another one here - old ...
I'm currently working on a project for medical image processing, that needs a huge amount of memory. Is there anything I can do to avoid heap fragmentation and to speed up access of image data that has already been loaded into memory?
The application has been written in C++ and runs on Windows XP.
EDIT: The application does some prepro...
In linux environment, when getting "glibc detected *** free(): invalid pointer" errors, how do I identify which line of code is causing it?
Is there a way to force an abort? I recall there being an ENV var to control this?
How to set a breakpoint in gdb for the glibc error?
...
We have similar code to the following in one of our projects. Can anyone explain (in simple English) why the fixed statement is needed here?
class TestClass
{
int iMyVariable;
static void Main()
{
TestClass oTestClass = new TestClass();
unsafe
{
fixed(int* p = &oTestClasst.iMyVari...
What is the difference between the following 2 ways to allocate and init an object?
AController *tempAController = [[AController alloc] init];
self.aController = tempAController;
[tempAController release];
and
self.aController= [[AController alloc] init];
Most of the apple example use the first method. Why would you allocate, init ...
I'm storing an object (TTF_Font) in a shared_ptr that is provided to me from a third-party API. I cannot use new or delete on the object, so the shared_ptr is also provided a "freeing" functor.
// Functor
struct CloseFont
{
void operator()(TTF_Font* font) const
{
if(font != NULL) {
TTF_CloseFont(font);
...