memory-allocation

How do the PROT flags within mmap(), translate to register values ?

I am interested in tracing how the mmap system call translates to register values on an ARM cpu. More interested in the path taken and where and when do these "PROT" attributes actually translate to a page attribute within the kernel. I did trace the system call till the "mmap_region" call under mm/mmap.c. From here, I fail to see where ...

Does VC++ support _mm_malloc ?

Does Visual Studio C++ 2008/2010 support _mm_malloc officially? It is defined in malloc.h but I can't find its description in the MSDN library. ...

Should I manage pages or just lean on virtual memory?

I'm writing a database-style thing in C (i.e. it will store and operate on about 500,000 records). I'm going to be running it in a memory-constrained environment (VPS) so I don't want memory usage to balloon. I'm not going to be handling huge amounts of data - perhaps up to 200MB in total, but I want the memory footprint to remain in the...

Unused namespace directives can cause any change ?

Hello everybody I am sure that codes will produce same result but CLR will consider unused namespace directives while allocating memory ? Another question can be that CLR consider unused code blocks while allocating memory ? ...

How else might a PHP CLI script determine its memory limit?

I need to run a PHP CLI script and give it a LOT of memory (it's an automatic documentation generator that needs to cover a large code base). I have a powerful machine and have allocated 5GB to php, both in php.ini and in an inline ini_set('memory_limit','5120M') declaration in the script file. If I add these lines to top of the script...

What is temporary allocation?

In C++, what is temporary allocation and when is it used? Does such a thing even exist? It was mentioned in the TA's course notes, but I couldn't find any info about it... ...

Where can I read more about memory structure in C++?

I came across this presentation while browsing SO some time ago, and it relates performance to specific memory allocation decisions. The author has some interesting diagrams that show how various objects are allocated by a C++ program, and goes on to optimise the program by making some changes in the code. His diagrams make sense in thei...

C++ vector copy elements?

I would like to use a dynamic array in C++ (something like an ArrayList or a Vector in Java.) In this example are the t1, t2... objects are copied or only its address is added to the vector? Do I need to implement a copy constructor for Node class or will the default constructor make a "proper" copy (because there is a pointer in the cla...

Now allocating four times the memory with @2x images

Now that UIImage imageNamed is using @2x images for iOS4's retina display, there is an obvious concern that since the images are now twice the size (pixels x pixels), that they will also be twice four times the size in memory. I know everyone stated something like you have a limit of 24mb in memory for the old devices (even though that ...

How to avoid the "swapping of death" during development?

Probably everyone ran into this problem at least once during development: while(/*some condition here that somehow never will be false*/) { ... yourvector.push_back(new SomeType()); ... } As you see the program starts to drain all system memory, your program hangs and your system starts to swap like crazy. If you don't rec...

Programmatically determine if a Cocoa object loaded from nib/xib is available

The setting is the following: I have a cocoa object in a nib file that is loaded when the NSWindow and view is loaded The window can be closed I also access the object programmatically Now what happens in some situations is that I get a crash, when I try to send a message to the object, but it has been deallocated before (because the...

Can a process running a 32bit compiled binary use more than 4gb of memory?

Is it possible for a single process running a 32bit compiled version of python in Snow Leopard (64bit machine) to appear to consume > 4gb (say 5.4gb) of virtual memory as seen by the top command? I did a file ...python to see that the binary was not x86, yet it appeared to be consuming over 5gb of memory. My guess is that the librari...

How come netbeans java profiler crashes with a heap overflow error at ~64mb?

I am trying to profile the memory usage of a program, but I keep getting a stack overflow error. The netbeans memory settings I am using are as follows: -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m The project memory settings I am using are as follows: -Xms256m -Xmx512m Here is screen shot. I am not sure where 6...

PHP Memory Management

I have a few time-consuming and (potentially) memory-intensive functions in my LAMP web application. Most of these functions will be executed every minute via cron (in some cases, the cron job will execute multiple instances of these functions). Since memory is finite, I don't want to run into issues where I am trying to execute a funct...

How does temporary storage work in C when a function returns?

I know C pretty well, however I'm confused of how temporary storage works. Like when a function returns, all the allocation happened inside that function is freed (from the stack or however the implementation decides to do this). For example: void f() { int a = 5; } // a's value doesn't exist anymore However we can use the retu...

Why python list slice assignment eats memory?

Hi all! I'm fighting a memory leak in a Python project and spent much time on it already. I have deduced the problem to a small example. Now seems like I know the solution, but I can't understand why. import random def main(): d = {} used_keys = [] n = 0 while True: # choose a key unique enough among used previ...

What is better in terms of memory allocation - subobject or a pointer to a separate object?

I have the following problem in a Visual C++ 9 program. There's a huge object that logically contains several subobjects. I can either store the subobjects inside the object or store pointers to subobjects allocated separately. The key point here is that there's always one instance of suboject of each type in one outer object - it is al...

Profile Memory Allocation in Python (with support for Numpy arrays)

I have a program that contains a large number of objects, many of them Numpy arrays. My program is swapping miserably, and I'm trying to reduce the memory usage, because it actually can't finis on my system with the current memory requirements. I am looking for a nice profiler that would allow me to check the amount of memory consumed b...

Concept of allocating free memory

Hello, I would like to know how memory allocation on the lowest levels works. For example if program wants to create some long array or anything else, how it will ask for the memory, how does the program ensure itself that it does not take memory same other program is using. I would be very grateful if someone would bring some light fo...

C# - Application Memory Problem

I have written a small WinForm application in C#. The EXE that is made is 74 Kb and all together with the resources and all it sizes 179 Kb. But when I run it, it takes 9.1 MBs in memory according to Task Manager. So my question is: Why is it happening? What can I do to reduce the size of this? If the size could be reduced how much r...