memory

How to write a memory efficient Python program?

It's said that Python automatically manages memory. I'm confused because I have a Python program consistently uses more than 2GB of memory. It's a simple multi-thread binary data downloader and unpacker. def GetData(url): req = urllib2.Request(url) response = urllib2.urlopen(req) data = response.read() // data size is about...

How does JavaScript memory work in browsers?

When building advanced JS-interfaces and games I've found that I have to dig deeper in to how browsers handles memory for JS. My experience with memory and JavaScript is that the memory gets glogged (and makes animations and calculation slow/lagging ) when: There is alot of JS-generated content on the page There is alot of graphics (i...

Why doesn't Python's mmap work with large files?

I am writing a module that amongst other things allows bitwise read access to files. The files can potentially be large (hundreds of GB) so I wrote a simple class that lets me treat the file like a string and hides all the seeking and reading. At the time I wrote my wrapper class I didn't know about the mmap module. On reading the docum...

Available RAM on shared hosting provider

I'm building business app that will hold somewhere between 50,000 to 150,000 companies. Each company (db row) is represented with 4-5 properties/columns (title, location,...). ORM is LINQ2SQL. I have to do some calculation, and for that I have lot of queries for specific company. Now, i go to db every time when i need something, and it ...

Javascript memory profiler

I'm looking for a good JavaScript Memory profiler, specifically one that targets IE. And any suggestions on how to go about finding javascript memory leaks would also be appreicated. ...

How to calculate the memory size of a program?

Lets say I have a c program where I use only stack variables, no dynamic variables (malloc, ...) Is it possible to calculate how much memory my program will take during run time? ...

Volatile variable

Where is a volatile variable stored in the stored in program memory(in which section) ? ...

Profile Memory Usage of Session State ASP.Net

I'm trying to figure out the size of a particular session state. On one of our heavy pages (lots of data in a table) it gets progressively slower. The issue is resolved by logging out of the system. I've profiled the page looking for JavaScript memory leaks, but I didn't find anything. My next plan of attack is too look at ViewState an...

LeakDiag for 64-bit Windows?

Has anyone been successful using LeakDiag to track memory allocation on 64-bit Windows? Or, do you know of another free tool to replace LeakDiag for 64-bit? ...

Does stack grow upward or downward?

I have this piece of code in c: int q=10; int s=5; int a[3]; printf("Address of a: %d\n",(int)a); printf("Address of a[1]: %d\n",(int)&a[1]); printf("Address of a[2]: %d\n",(int)&a[2]); printf("Address of q: %d\n",(int)&q); printf("Address of s: %d\n",(int)&s); The output is: Address of a: 2293584 Address of a[1]: 2...

CUDA vs. CuBlas memory management

I have noticed that I can use memory blocks for matrices either allocated using cudamalloc() or cublasalloc() function to call cublas functions. The matrix transfer rates and computational are slower for arrays allocated using cudamalloc() rather than cublasalloc(), although there are other advantages to using arrays using cudamalloc(). ...

C++ Object, Member's Memory Position Offset

Is there a better method to establish the positional offset of an object's data member than the following? class object { int a; char b; int c; }; object * o = new object(); int offset = (unsigned char *)&(object->c) - (unsigned char *)o; delete o; ...

My (huge) application throws an OutOfMemoryException, now what?

This is by far the most complex software I've built and now it seems to be running out of memory at some point. I haven't done extensive testing yet, because I'm a bit lost how I should approach the problem at hand. HandleCount: 277 NonpagedSystemMemorySize: 48136 PagedMemorySize: 1898590208 PagedSystemMemorySize: 189036 PeakPagedMemory...

MySQL - best storage engine for constantly changing data

I currently have an application that is using 130 MySQL table all with MyISAM storage engine. Every table has multiple queries every second including select/insert/update/delete queries so the data and the indexes are constantly changing. The problem I am facing is that the hard drive is unable to cope, with waiting times up to 6+ secon...

Python: How much space does each element of a list take?

I need a very large list, and am trying to figure out how big I can make it so that it still fits in 1-2GB of RAM. I am using the CPython implementation, on 64 bit (x86_64). Edit: thanks to bua's answer, I have filled in some of the more concrete answers. What is the space (memory) usage of (in bytes): the list itself sys.getsizeof(...

How to get the root cause of a memory corruption in a embedded environment ?

Hello, I have detected a memory corruption in my embedded environment (my program is running on a set top box with a proprietary OS ). but I couldn't get the root cause of it. the memory corruption , itself, is detected after a stress test of launching and exiting an application multiple times. giving that I couldn't set a memory break ...

Problem with memory leak on iPhone...

I have a strange problem with a memory leak (the only one ;-) ) in my iPhone app: I don't know where I have to look for the cause of this leak... the strange thing is that this, exactly this leak also shows up if I create a new navigation-based app and just run it without any changes. I'm testing it in the simulator BTW because I don'...

does argument in printf get located in memory?

in c, when I write: printf("result %d ",72 & 184); Does "72 & 184" get a a block in memory (for example 72 takes 4 bytes, 184 takes 4 bytes?...) ...

How can I reuse objects in JavaScript?

I'm not new to JavaScript, but I've never really had too much in-depth knowledge of how it works. I'm currently developing some software for a cell phone that is done completely in JavaScript. Everything runs fine, except that once in a while the garbage collector kicks in, and everything stops momentarily. The problem is that objects a...

Alternatives to mprotect()

The mprotect syscall protects the memory area within page boundary: int mprotect(void *addr, size_t len, int prot); Here len should be multiple of pagesize. Is there any way to protect only a few consecutive addresses, which are not aligned to page boundary i.e. len < pagesize ? ...