memory

How does a new statement allocate heap memory?

private button btnNew=new button(); btnNew.addclickhandler(this); private DataGrid grid; private void onClick(event click) {grid=new DataGrid();} Hello ,I write a code like this sample ,I want to know that every time a user click on btnNew,what is going on in heap and stack memory?for example does a new block in heap memory assign to t...

Why do functions in some popular languages return only a single result?

Why do functions in some popular languages return only a single result? ...

[C++] Cast int16_t memory to float

Hi Stackoverflow, I have a function from an external source that returns an array of 2 uint16_t elements (which I cast to int). I have already been able to cast these to one "big" int ((i1 << 16) + i2) Now I need to be able to cast this to float, keeping the point value as is in memory. Can anyone suggest a way or point me in the rig...

Track down memory leak in Ruby 1.9

I have a Ruby application that uses eventmachine and starts 16 processes that each manage 1000 connections. Initially each process only uses around 150MB, however after some runtime they consume more and more towards 500MB and I am running out of memory and swap. The amount of open connections (indicated by EM.connection_count) is normal...

loadView is called when get a message like "Received memory warning level 1"

hi, all: I am developing an App for iphone. Now i create a ViewController subClass which is named WriteViewController, and i create the view of WriteViewController by override loadView() function. The view of WriteViewController is an instance of WriteView. In WriteView, I have a instance of UIImage which holds an image object. I set t...

When is memory allotted to static variables in C++

Hi ! I am a newbie to C++ and facing a problem. I read in a book that memory is allotted to a static variable, once the object is created of that class. Now, what if I make this static variable global ? When would be it initialized in that case ? Plus, I have also read in some articles that static variables are allotted on heap and the...

In memory jar / class file execution

Hi, I have a jar file (say app.jar) in a certain location available as a file/stream from an http server. The problem is that app.jar is itself a frequently updated jar file being updated regularly at the server. I have another jar file (say load.jar) which is simply downloadable by any user. At runtime, the user runs the load.jar, whic...

Optimizing memory footprint of a .NET application with a huge number of instances

I have an application that holds huge number of instances in-memory for performance reasons, and I don't want to write it to disk or any other place, just hold it all in-memory. public class MyObject { public string Name; public object Tag; public DateTime DateTime1; public DateTime DateTime2; public DateTime DateTi...

Smartphone Memory Configuration

Smart-phones have built in ROM and RAM separately. Also a few phones has virtual memory support too. I would like to know what these memories are basically used for. I understand that RAM is available to user processes. But why do they have a big chunk of ROM? E.g. The wiki page for Droid Incredible says 512 MB DDR RAM 1 GB ROM (748 M...

Void* pointer problem

Pretty new to c++, i have a rather (i think) stupid question about a piece of code : class DataStream { protected: DataStream(void) { }; public: DataStream(int Length); ~DataStream(void); ... void* DataPtr; int Length; }; I do have a class similiar to this and i want to assign to DataPtr a pointer to some data allocated. When i...

0xffff0 and the BIOS

Hello all, I have a quick question that I can't seem to find the answer to. When a pc first boots up, it starts executing at physical address 0xffff0. This address contains a jmp instruction to the BIOS. Now for my question, I always assume the physical addresses are mapped to RAM. If RAM initially contains garbage values, what exac...

How to limit memory of a OS X program? ulimit -v neither -m are working

My programs run out of memory like half of the time I run them. Under Linux I can set a hard limit to the available memory using ulimit -v mem-in-kbytes. Actually, I use ulimit -S -v mem-in-kbytes, so I get a proper memory allocation problem in the program and I can abort. But... ulimit is not working in OSX 10.6. I've tried with -s and...

App crashes (only) after installation

Hi, I compiled an fine working project (before compiled with 3.1.3) now with 3.2.1 Now after installation from XCode to Device it needs quite long to install and after it runs a few seconds later i just see for short a red alert at the top (can't read, it's too fast) and the app closes itself. When I then start the installed app... al...

I'm doing funky things with placement new, and things are failing. Workarounds?

I have a very large, spread out class that is essentially a very contrived two dimensional linked list. I want to be able to "compile" it, by which I mean I want to finalize the list, so that only read accesses may be made, and then move all the elements into contiguous memory spaces. My rough solution is this: #include <new> ... MyLis...

Freeing dynamically allocated memory

In C++, when you make a new variable on the heap like this: int* a = new int; you can tell C++ to reclaim the memory by using delete like this: delete a; However, when your program closes, does it automatically free the memory that was allocated with new? ...

get job list queue from printer memory

Hey ;) I know that my network printer (big Konica Minolta) have own memory and storage there some info like printed jobs. It is possible to get from this memory this information? I try to use Win32_Printer or Win32_PrintJob but as I read it gets only jobs queue from Windows dialog box ... Have You some idea how resolve my problem ? ...

Running executable from memory

I'm trying to run an executable directly from a byte[] representation of this executable as a resource in C#. So basically i want to run a byte[] of an PE directly without touching the harddisk. The code I'm using for this used to work but it doesn't anymore. The code creates a process with a frozen main thread, changes the whole proc...

Release message to a UINavigationController object

Hello, I am relatively new to Cocoa programming, and some aspects of memory managing are still troubling me. In this case, I am creating a UINavigationController using the alloc message, and initialising it with a UIView controller. Then, I am presenting the view modaly by passing it to the presentModalViewController method. Below is ...

why the memory is still holding when I do removefromsuperview?

I'm currently working on a ipad project and found this. so here is my structure i subclassed uiviewcontroller as customizedVC,like this @protocol customizedVCDelegate -(void)viewclosed:(UIView *)view oldviewcontroller:(UIViewController *)oldvc newvcname:(UIViewController *)newvc; @end @interface customizedVC : UIViewController { ...

My iphone app is having memory problems and eventually crashes - uses a lot of images

I am new to programming (learned how to write apps a few months ago) and recently wrote an app that crashes every time after about 5 minutes with several 'Received memory warning. Level=1' warnings. While testing with instruments, I have been unable to detect any leaks and I'm fairly confident I'm releasing the objects correctly so I su...