memory

Why might string concatenation prefix each concatenation with garbage?

I'm pretty new to C, so I apologize if this is pretty standard knowledge.. I have a function like so, where I am appending a bunch of C-style strings together and outputting it: char *example(int n, int days, int years){ char *ret; if (n < 5) { ret = (char*)malloc(sizeof(char)*256); sprintf(ret, "There are %d da...

So much memory being malloc'd that I get "Killed" when running my program deep enough..

I have a program that goes n^2 layers deep of recursion and mallocs a bunch of memory to concatenate char*s together. With a large enough n, the process just gets killed by the server (since it is consuming too much memory). How can I release this memory and still have my data? It's mallocs look like test = (char *)malloc(sizeof(cha...

splitting a list in jQuery - conscious of memory and reusability.

I'm trying to write a function in jQuery that will split lists - or really, any element that has children - that is conscious of memory use and is general enough to be widely reusable, but I'm having trouble resolving these against one another. For the sake of argument (and to keep the code on point) let's say I'm trying to split the li...

Why does each location in memory contain 8 bits?

Somebody has confirmed there are 8 bits in every location/address in memory. Can I know why? is it related to the memory chip architecture? Or is it because of 32bit CPU. Is this 8 bits true for another OS such as FreeBSD, Mac, Linux? Is there any relation the amount of bits in every location to the count of address line in memory? Is ...

How to access a data structure from a currently running Python process on Linux?

Hi, I have a long-running Python process that is generating more data than I planned for. My results are stored in a list that will be serialized (pickled) and written to disk when the program completes -- if it gets that far. But at this rate, it's more likely that the list will exhaust all 1+ GB free RAM and the process will crash, lo...

Memory problem for db reader

hi! I have an "select * from tables..joins..." query on an oracle database, wich would return about 22 milions rows. I'm using C# and ODP.NET , like so : oracleDataReader odr = command.ExecuteReader(); But during execution of this statement, the process takes about 1,5 Gb RAM, wich is not very good. Any ideea on how to save some memory ...

Large portlet war takes up memory causing performance issues?

I have heard a few people say that deploying a portlet war file (or perhaps any war) that includes a lot of large jars can cause performace issues because all those jars get loaded into memory. If you have several wars, all of which include a ton of large jar files, your system will get bogged down. I'm trying to get my head around why...

ASP.NET: Multilingual support without resource files.Whats the best approach and data structure ?

I have an asp.net web application which i want have multilingual support now.For some reasons,the management is not ready to use satellite assemblies or resource file.They want to have it table driven.so i created tables to store the text for each part of the page.I dont want to make a call to db every time the page control loads.Ex: if ...

Structs on the stack (ANSI C)

Dear all Having started to study Ulrich Dreppers "What every programmer should know about memory" [1] series I got stuck when trying to reproduce the examples presented in section 3.3.2 Measurements of Cache Effects As far as I understand the structures should be allocated on the stack since then they are in memory one after another....

Caching strategies for Windows end-user applications?

I'm working on what is essentially the runtime for a large administrative application. The actual logic that is being executed, as well as the screens being shown and the data operated upon is stored in a central database. In order to improve performance, the runtime keeps data queried from the database in various caches. However, it is...

Question about Compute Prof's fields for incoherent and coherent gst/gld? (Cuda/OpenCL)

Hey all, I am using Compute Prof 3.2 and a Geforce GTX 280. I have compute capability 1.3 then I believe. This file, http://developer.download.nvidia.com/compute/cuda/3_0/toolkit/docs/visual_profiler_cuda/CUDA_Profiler_3.0.txt, seems to show that I should be able to see these fields since I am using a 1.x compute device. Well I don't s...

Java Servlet Excel export refreshes the request every 300 seconds - even when the first one isn't done yet

I'm working on a program that often does Excel exports from hypermassive database tables. One test case I'm doing right now does about 300k rows by 40 columns into one xlsx worksheet. It completes in about 6 minutes or so, taking about 1.1GB RAM, but I've run into a major hangup - after exactly 300 seconds have passed, I see this patte...

MPMoviePlayerViewController iPad Memory Leak

My movie player leaks memory only on the iPad and only when the "Done" button is clicked. If the movie plays to completion then it cleans itself up properly. Here is the play code: mViewPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[self movieURL:@"mymovie"]]; [self.parentViewController presentModalViewController:mV...

Rationalizing what is going on in my simple OpenCL kernel in regards to global memory

const char programSource[] = "__kernel void vecAdd(__global int *a, __global int *b, __global int *c)" "{" " int gid = get_global_id(0);" "for(int i=0; i<10; i++){" " a[gid] = b[gid] + c[gid];}" "}"; The kernel above is a vector addition done ten times per loop. I have used the prog...

Is my proccess memory constant?

It is an academic question. If I have a constant number of variables, objects, etc. And we assume that GC will not kick in, and there is no bottlenecks. Could some other factor force my application memory to fluctuate? In such a scenario would allocated by my proccess memory stay constant? ...

Delphi IDE out of Memory Error caused by GExperts window open

I noticed that there are a lot of IDE memory problems and this is a place where real answers to these issues are found. So.. I thought I would make a section available for answers to (at least) this question is, since I found no other to fix this problem on the net. My problem was that I left my work space for a few hours and when I ret...

Internet Explorer Address Space

Though i'm currently interested in internet explorer address space i wouldn't mind a general answer. The question is how can i calculate the address space ( and by address space a mean the minimum and maximum address in memory -correct me if i'm wrong- ) of a windows process. Actually is this space fixed or varied ? Also do i get to kno...

UIImage from photo library very large

Hi everyone! In my game I'm grabbing an image from the iPhone's photo library using the UIImagePickerController, which returns a UIImage. Because the image is a huge resolution (1536x2048), this UIImage takes up almost 20mb in memory. To resolve this, I shrink the image significantly before using it to generate a sprite and this works i...

jRuby: How to correctly purge old interpreted code?

I've been testing out JRuby as a possible integrated language to a larger system, but I've run into a problem: heap space. Specifically, JRuby holds on to all the objects it uses when parsing code. I'm not talking about perm space here - there are large quantities of org.jruby.internal.runtime.methods.InterpretedMethod instances building...

what do the "---p" permissions in /proc/self/maps mean ?

I understand the meaning of rwxps bits. r-xp is for .text. rw-p is for .data/.bss/heap/stack. What is the use of just "---p" pages For e.g see this output of bash> cat /proc/self/maps 00400000-0040b000 r-xp 00000000 08:03 827490 /bin/cat 0060b000-0060c000 rw-p 0000b000 08:03 827490 ...