memory-allocation

VB.Net 3.5 MDI Application - MDIChild forms stop opening after N memory has been used.

Hi Guys, I hope someone may be able to help! We have a pretty large VB.Net MDI application that has been converted from VB6. When it is first run up with no MDIChild forms opened it uses about 35,000K. As more and more forms are opened (but not closed) the memory usage (according to Task Manager) creeps up at approximately 4,000K per f...

Getting the lowest free virtual memory address in windows.

Title says it pretty much all : is there a way to get the lowest free virtual memory address under windows ? I should add that I am interested by this information at the beginning of the program (before any dynamic memory allocation has been done). Why I need it : trying to build a malloc implementation under Windows. If it is not possi...

In what situations Static Allocation fares better than Dynamic Allocation?

I was going through some of the decisions made to make Xara Xtreme, an open source SVG graphics application. Their memory management decision was quite intriguing to me since I naively took it for granted that on-demand dynamic allocation as the way of writing object oriented application. The explanation from the documentation is ...

Why are stack overflows still a problem?

This question is mystifying me for years and considering this site's name, this is the place to ask. Why do we, programmers, still have this StackOverflow problem? Why in every major language does the thread stack memory have to be statically allocated on thread creation? I will speak in the context of C#/Java, because I use them most...

Getting allocation count plus one at UIImage in objective-c?

Hi Guys, I am getting allocation count plus one in the below code. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"]; if (cell == nil) { cell = [[[UITableVie...

XCode and Instruments: How to get the app memory peak

I'd like to show the memory peak (not 'leak', but the highest quantity of memory used in small amount of time) of an iPhone app i am running in the simulator. Where shall i look precisely? PS I am using libxml2 and i suppose that the allocations done by the library aren't considered ...

In C#, how do inferred variables using var behave with respect to memory and lifecycle?

Ok, I've been reading everything I can find on var, and I'm pretty sure I've got a handle on their basic behaviors and type inference. I've always been a big proponent of explicit types, so var makes me a little edgy when I'm reading code. So I have a couple of questions regarding its memory usage and the behavior of a variable declared ...

Java XML parser without excessive memory allocation

At work I am parsing large XML files using the DefaultHandler class. Doing that, I noticed that this interface allocates many Strings, for element names, attribute names and values, and so on. From that, I thought about creating an XML parser that only does the absolute minimum of object allocation. Currently I need: one StringBuilder...

Memory footprint of Haskell data types

How to find the actual amount of memory required to store a value of some data type in Haskell (mostly with GHC)? Is it possible to evaluate it in runtime (e.g. in GHCi) or is it possible to estimate memory requirements of a compound data type from its components? In general, if memory requirements of types a and b are known, what is me...

O* p = new O[5]; What does p point to?

To the first O of the array? ...

SomeClass* initialEl = new SomeClass[5];

Should SomeClass* initialEl = new SomeClass[5]; necessarily compile, assuming SomeClass does not have a non-publicly declared default constructor? Consider: /* * SomeClass.h * */ #ifndef SOMECLASS_H_ #define SOMECLASS_H_ class SomeClass { public: SomeClass(int){} ~SomeClass(){} }; #endif /* SOMECLASS_H_ */ /* * main.c...

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 I need std::get_temporary_buffer ?

For what purpose I should use std::get_temporary_buffer? Standard says the following: Obtains a pointer to storage sufficient to store up to n adjacent T objects. I thought that the buffer will be allocated on the stack, but that is not true. According to the C++ Standard this buffer is actually not temporary. What advantages does ...

PHP Memory Exhaustion error, poor code or just increase memory limit?

I am trying to read 738627 records from a flat file into MySQl. The script appears to run fine, but is giving me the above memory errors. A sample of the file is: #export_dategenre_idapplication_idis_primary #primaryKey:genre_idapplication_id #dbTypes:BIGINTINTEGERINTEGERBOOLEAN #exportMode:FULL 127667880285760002817317350 127667880285...

programmatic memory tracking in java

I am working on a large pre-existing system and can't use any of the external profiler tools that have been mentioned in other questions. That being said, is there any programttic way for me to get java to print out what variables are still allocated and using heap space? Variable name and type would be ideal but any identifying variab...

NSString *string = @"someString" vs NSString *string = [[NSString alloc] initWithFormat@"%@", string]

If I have a method - (void) myMethod:(NSString *)string { [Object anothermethodWithString:string]; } and I call [Object myMethod:@"this is a string with no alloc statement"] Do I need to do something like - (void) myMethod:(NSString *)string { NSString *string2 = [[NSString alloc] initWithFormat:@"%@", string]; [Object...

How to calculate the max memory that can be used by a java app

Hi Folks, I have a java app that has a max heap of 1024M,it has perm gen space of 256M. Does it guarantee that this app will never use more than 1280M (1024+256) ? Does the stack memory also come from the heap size above or is it extra memory consumption? What if the java app uses native code that consumes memory then where does this...

Progamming / memory / logical issue in code

Can you tell me is there any thing wrong in the code, my application is crashing randomly I cannot find any possible logical or memory error, please help as this is going out of my scope. #define __FN__ "CGD9_gd_ParseAddFieldsProC" int CGD9_gd_ParseAddFieldsProC (CGD_gd_ParseAddFields_Iparam_t *i_param_st_p) { t_gd9adfld_t *p_ext_fi...

Correct values for Heap Growth and Still Alive on Instruments Allocation

Hi, I'm trying to find all memory abandoned using instruments. The leaks test has been passed and at least it can't find any memory leak. I'm doing some repeated actions between each Marked Heap, and the average is 100,00 kb for heap growth and 1000 objects alive. Doing a quick search on each snapshot, I found 700 with a heap of 64 ...

Reallocating an array (C99)

The standard specifies that the contents of reallocated space is undefined if the new size if larger. If preserving the contents of the previously-allocated space is important, is the best way to reallocate data as follows: copying it to the stack, freeing it from the heap, allocating on the heap with more space, and copying back to the...