memory

Boost mmap performance vs native memory maps.

I will be writing a benchmarking tool that will test a mix of IOPS and bandwidth of a disk system and as such I will be turning to file backed memory maps for IO. Because the tool is going to need to be on both POSIX and WinNT platforms I can't just use plain old mmaps. Also from what I understand you have to madvise the Linux kernel tha...

My allocated memory is beeing written to

Im writing a project in Objective-C but I'm relying quite much on plain old C since there's OpenGL involved. I have a data blob that I read to memory from a file in the following way: NSString *path = [[NSBundle mainBundle] pathForResource:@"iPadTest" ofType:@""]; NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path]; dat...

Maximum number of fields for a C++ object

This answer states that in Java the maximum number of fields an object may have is 65536. Is there any such limit imposed on an object in C++? ...

Is this a memory leak?

I have a ListActivity containing an object I've defined called a MessageItem. I want to pass the data in this MessageItem off to a Service to do some stuff, but I don't want the Activity to be data bound to the Service such that Android can't reclaim the Activity if it needs to (ergo memory leak). What I'm doing is passing the MessageI...

How Make A Text File In Memory And Write Something On It And Open NotePad In Client And Open That File In It?

Hi My Dear Friends : How can i Make A Text File In Memory(Ram -> Save NoWhere) And Write Something On It And Open NotePad on top of Client browser And Open That Text File In It And Let the user save it by him/her self? -> in code behind thanks in future advance best regards ...

How to intentionally cause a "Fatal error: Allowed memory size of xxx bytes exhausted"

Whenever I've received this error, I just increased the memory to fix it. I have a case where, for testing purposes, I want to cause a page to use up all the memory however big I set the memory_limit. I have no idea how to go about doing that. EDIT: I tried this: <?php echo "start"; @ini_set('memory_limit', '1M'); $test = "a"; while ...

garbage collection of jquery.html

i was wondering if the following code would cause some problems like memory leak <html> <head> <script type='text/javascript' src='jquery-1.4.2.js'> </script> <script type="text/javascript"> function a(){ for(var i = 0; i < 50000; i++){ $("#d").html("<span>" + i + "</span>"); } ...

possible memory leak?

i'm profiling the below code inside a singltone and found that a lot of Rate objects are kept in memory altough i clear them. protected void FetchingRates() { int count = 0; while (true) { try { if (m_RatesQueue.Count > 0) { List<RateLog> temp = null; lock (m_RatesQueue) { te...

Is there a way to optimize the way I generate a file and output it as .zip in a java servlet?

A user has a few Lookup selections on a JSP page. After he's selected what data he wants exported, the JSP calls my servlet which should do something like this: get request data generate SQL for the request data execute the SQL and write it to a XML file package the XML file to a ZIP file and return it as a response Now, the first tw...

Does endianness have an effect when copying bytes in memory?

Am I right in thinking that endianess is only relevant when we're talking about how to store a value and not relevant when copying memory? For example if I have a value 0xf2fe0000 and store it on a little endian system - the bytes get stored in the order 00, 00, fe and f2. But on a big endian system the bytes get stored f2, fe, 00 and ...

C++ game trainer process monitoring

I am going to open game process from my trainer app and write some values to memory. I have no problems with opening a process and writing a value to memory. But I can't realize how to monitor the game process availability. For example I opened a running process, user closed it and opened again. How can I track this in my code? OpenProce...

Memory Units, calculating sizes, help!

I am preparing for a quiz in my computer science class, but I am not sure how to find the correct answers. The questions come in 4 varieties, such as-- Assume the following system: Auxiliary memory containing 4 gigabytes, Memory block equivalent to 4 kilobytes, Word size equivalent to 4 bytes. How many words are in a block, expressed...

Does any operating system implement buffering for malloc() ?

A lot of c/malloc()'s in a for/while/do can consume a lot of time so I am curious if any operating system buffers memory for fast mallocs. I have been pondering if I could speed up malloc's by writing a "greedy" wrapper for malloc. E.g. when I ask for 1MB of memory the initial allocator would allocate 10MB and on the 2nd, 3rd, 4th etc.....

Linked List in C (memory problems)

I'm creating a simple linked list in C in order to get used to some memory management. I've defined a node structure that holds a char* key, char* value and a node* next. void newnode(node *n, int x, int y) { n->key = malloc(x*sizeof(char)); n->value = malloc(y*sizeof(char)); } //This how i create a new node given a key and v...

What is a good way to force Perl 5 to run out of memory quickly on OS X?

I am trying to test a specific condition the will only occur if perl has a malloc that fails due to there being no memory left. I would like perl to die as quickly as possible. I figured the fasted way would be create some huge arrays like perl -le '$_->[100_000_000_000] = 1 for \(@a, @b, @c, @d); <>' But I had to kill it after my sw...

In Scala or Java, how to get how much RAM does application currently occupy?

NetBeans IDE has a taskbar indicaror, showing how much RAM is currently allocated and used by the running instance. How can I get this data in my own application written in Scala? If there's no special function for this in Scala, I could use Java one. ...

Valgrind / Memory Errors

I'm receiving the following errors repeatedly throughout my code when I use valgrind. I'm not quite sure what these mean and I can't identify the uninitialized values. ==16795== Conditional jump or move depends on uninitialised value(s) ==16795== at 0x4A06E8A: strcmp (mc_replace_strmem.c:412) ==16795== by 0x4009C7: dictionary_add...

pushViewController memory leak

Hello everyone, I have following code, instrument indicate that the pushViewController method has 32 bytes memory leak on device. Could you please kindly help check what rule I break? Should I change some "retain" to "assign" for declaration? Thanks in advance! @interface GuideNewsViewController : UIViewController <UITableViewDataSourc...

Java memory usage on Linux

I'm running a handfull of Java Application servers that are all running the latest versions of Tomcat 6 and Sun's Java 6 on top of CentOS 5.5 Linux. Each server runs multiple instances of Tomcat. I'm setting the -Xmx450m -XX:MaxPermSize=192m parameters to control how large the heap and permgen will grow. These settings apply to all the ...

Freeing struct with pointer and non-pointer variables

I'm trying to implement linked-lists with c struct, I use malloc to allocate a new node then allocate space for value, so I've been thinking how to free the structure once I'm done with them, my structure looks like this: typedef struct llist { char *value; int line; struct llist *next; } List; I have a function that wa...