memory

Copying a large stream to String - Java

I am writing a StringOutputStream class in Java because I need the pre-Base64-encoded data from an OutputStream to go to a String. I need this as a String because I am going to be putting it into a W3C XML Document. Everything would be fine, but I'm dealing with (relatively) large objects. The resulting object turns out to be about 25 M...

How to safely operate on parameters in threads, using C++ & Pthreads?

Hi. I'm having some trouble with a program using pthreads, where occassional crashes occur, that could be related to how the threads operate on data So I have some basic questions about how to program using threads, and memory layout: Assume that a public class function performs some operations on some strings, and returns the result ...

f# interactive System.OutOfMemoryException

f# interactive throws System.OutOfMemoryException when loading large objects into memory. Exception is thrown at approximately 1.3 gigs. Data set is 2.2 gigs, and loads fine in debugger mode. Using VS2008 with April 2010 CTP This is mostly a java library that is being used via ikvmc, but if that were an issue, it shouldn't be running ...

How much RAM used by Python dict or list?

My problem: I am writing a simple Python tool to help me visualize my data as a function of many parameters. Each change in parameters involves a non-trivial amount of time, so I would like to cache each step's resulting imagery and supporting data in a dictionary. But then I worry that this dictionary could grow too large over time. M...

Python subprocess: Cannot allocate memory (after a few days of not restarting apache)

I use check_call('convert ...', shell=True) to open the process. This is run inside apache. I start getting this exception after a few days: File "/usr/lib/python2.6/subprocess.py", line 457, in check_call retcode = call(*popenargs, **kwargs) File "/usr/lib/python2.6/subprocess.py", line 444, in call return Popen(*popenar...

Reading and writing to SysV shared memory without synchronization (use of semaphores, C/C++, Linux)

Hi, I use SysV shared memory to let two processes communicate with each other. I do not want the code to become to complex so I wondered if I really had to use semaphores to synchronize the access to the shared memory. In my C/C++ program the parent process reads from the shared memory and the child process writes to the shared memory. ...

c# : simulate memory leaks..

Hi, I would like to write the following code in c#. a) small console application that simulates memory leak. b) small console application that would invoke the above application and release it right away simulating managing memory leak problem.. In other words the (b) application would continuously call and release application (a) to si...

Android setImageURI out of memory error

I have a very small activity that must show an image. If picture is not very small (for example 1.12 Mb 2560x1920) it produces out of memory on change screen orientation. I tried getDrawable.setCallback(null) but no luck. Where am I wrong? public class Fullscreen extends Activity { @Override public void onCreate(Bundle savedInstanceS...

Memory usage of strings (or any other objects) in .Net

I wrote this little test program: using System; namespace GCMemTest { class Program { static void Main(string[] args) { System.GC.Collect(); System.Diagnostics.Process pmCurrentProcess = System.Diagnostics.Process.GetCurrentProcess(); long startBytes = pmCurrentProcess.Priva...

How can I retrieve the amount of free RAM from a Java program?

Free RAM: my target metric. Java: my tool of choice. ???: a good way to get the former using the latter. ...

Java memory usage increases when App is used, but doesnt decrease when not being used.

I have a java application that uses a lot of memory when used, but when the program is not being used, the memory usage doesnt go down. Is there a way to force Java to release this memory? Because this memory is not needed at that time, I can understand to reserve a small amount of memory, but Java just reserves all the memory it ever u...

How to create temporary files in memory visible for other process, using python

Hello! I'm trying to write simple batch file generator in python. Batch file consist of about 30-50 lines of text and is passed to other applications. During the execution of script there a lot of calls to external applications. I want to create file in memory (like named pipes in win32). Is there any platform-independent way? UPD: Tha...

create a sparse BufferedImage in java

I have to create an image with very large resolution, but the image is relatively "sparse", only some areas in the image need to draw. For example with following code /* this take 5GB memory */ final BufferedImage img = new BufferedImage( 36000, 36000, BufferedImage.TYPE_INT_ARGB); /* draw something */ Graphics g = img.getG...

Linux Core Dump Without Killing Process

Is it possible to generate a core dump without killing the process? If so, what is the command/signal to do so? Thanks, Jim ...

Flex 4 Keeping Data Providers In Memory

I am working on a modularized Flex application, and I am trying to cut-down on the amount of client-server interaction. Every time a module is opened, a request is made to a web service to get values to bind to the Flex form. If a user closes the module, and then reopens it at another time during their session, the same web request wil...

What is "Virtual Size" in sysinternals process explorer

Hi My application runs for few hours, There is no increase in any value ( vmsize, memory) of Task Manager. But after few hours i get out of memory errors. In sysinternals i see that "Virtual Size" is contineously increasing, and when it reach around 2 GB i start getting memory errors. So what kind of memory leak is that ? How can i d...

'Bank Switching' Sprites on old NES applications

I'm currently writing in C# what could basically be called my own interpretation of the NES hardware for an old-school looking game that I'm developing. I've fired up FCE and have been observing how the NES displayed and rendered graphics. In a nutshell, the NES could hold two bitmaps worth of graphical information, each with the dimen...

Memory ReAllocation

What is the right and best way to reallocate memory? for example I allocate 100 bytes with WinAPI function HeapAlloc then I fill 100 bytes of that memory with some data and now I want to add more new data at end of previous... What Should I do? Make a new allocation with more bytes and then copy old+new to new location and free old memo...

Android: Memory leak due to AsyncTask

Hello, I'm stuck with a memory leak that I cannot fix. I identified where it occurs, using the MemoryAnalizer but I vainly struggle to get rid of it. Here is the code: public class MyActivity extends Activity implements SurfaceHolder.Callback { ... Camera.PictureCallback mPictureCallbackJpeg = new Camera.PictureCallback() { publi...

is it wasteful/bad design to use a vector/list where in most instances it will only have one element?

is it wasteful/bad design to use a vector/list where in most instances it will only have one element? example: class dragon { ArrayList<head> = new ArrayList<head> Heads; tail Tail = new tail(); body Body = new body(); dragon() { theHead=new head(); Heads.add(theHead); } void nod() { ...