memory-management

Tracking Memory Usage in PHP

I'm trying to track the memory usage of a script that processes URLs. The basic idea is to check that there's a reasonable buffer before adding another URL to a cURL multi handler. I'm using a 'rolling cURL' concept that processes a URLs data as the multi handler is running. This means I can keep N connections active by adding a new URL ...

Good Websites/Blogs/Books to know about Memory Efficient C# Programming

Based on a Memory Efficient Programming question on StackOverflow ..... I want to know about Memory Efficient C# Programming.... Any good Websites/Blogs/Books to know about Memory Efficient C# Programming..... EDIT: Some tips how to write Memory Efficient C# Programming.... ...

NSString retain copy question

Hi, I've seen a few posts on here about the issue of using retain or copy for strings. I still can't quite get my head around the difference or the importance. In my case at the moment I have a class with a whole load of nsstrings to hold strings. I want this class to only be instantiated once and I want its nsstring variables to chan...

When object is contructed statically inside a function, would it be allocated on the heap or on the stack?

if i have the following code: for (...) { A a; } would a be allocated on the heap or on the stack? ...

How to discover memory usage of my application in Android

I would like to know how I can find the memory used on my Android application, programmatically. I hope there is a way to do it. Plus I would like to understand how to get the free memory of the phone too. ...

What is the difference between applicationDidReceiveMemoryWarning , didReceiveMemoryWarning?

Hi all, What is the difference between applicationDidReceiveMemoryWarning and didReceiveMemoryWarning ? And what is the best way to handle those warnings. ...

NSarray release

Hello everybody, If i declare an NSArray with alloc & retain in single sentence then should i release the NSArray object twice (i.e. [arrayObject release] 2 times) ? ...

std::vector, std::map and memory issues

I am writing code that inserts rows from a database into a vector. The vectors are then stored in a std::map. This architecture allows me to logically partition the datasets (vectors), based on the map key. In my code, I will be retrieving a dataset (i.e. vector) from the std::map, adding/removing rows to it or performing some other log...

Does getting random SIGTRAP signals (in MinGW-gdb) is a sign of memory corruption?

I wrote my own reference counted memory manager c++ (for fun) and I'm sure it isn't perfect ;) . And now when I'm trying to use it I got random SIGTRAP signals. If I comment out every line which are in connection with that memory manager everything runs fine. Getting SIGTRAP-s instead of SIGSEGV is quite strange. I know that SIGTRAP-s ar...

Package Memory Management

Since I have been running in a lot of difficulties when trying to use DLLs, I decided to try out runtime packages (mainly to avoid the memory manager and type registry problems). From my application I do something like this: HandleList := TList <THandle>.Create; try PackageObj.DoSomething (HandleList); finally FreeAndNil (HandleLi...

Share Memory Manager between Application and Package

This question is a follow up of this question. How can I achieve that my application and my runtime package use the same memory manager? I thought that this was the case by default but since I get strange access violations and invalid pointer exceptions, I inserted calls to GetMemoryManagerState just before entry to the runtime package ...

Tomcat memory and virtual hosts

Hello; I have a VPS on which I serve Tomcat 6.0. 500mb memory was enough, when I had only two applications. Last week I deployed another web application and formed a new virtual host editing Tomcat server.xml. But the server responses slow down, linux started to eat the swap. When I increased the memory 750 mb it become stable again. Bu...

iPhone - Handling Memory with Multiple Views

Hi, Here is a piece of code from the exploring the iPhone SDK book. It uses the example of 2 views. It checks to see which view is being used and will release the other one. - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it // doesn't have a superview // Release anything that's ...

Does this cause a memory leak (in .NET)?

I have a memory leak question. Will the instances of obj ever be eligible for garbage collection until the class instance of TopClass goes out of scope? public class TopClass { public void MyFunction() { TestClass obj = new TestClass(); obj.PropertyChanged += (s,e) => { //Do some code }; obj = null; } } Furthermore t...

Creating physical memory from user space to use for DMA transfers

I want to create some memory to use for DMA transfers. (Using Linux 2.6.18-128.el5 #1 SMP) I have a API stack+kernel driver for my H/W that can do this for me, but its very very slow! If I use the API to create a DMA transfer, it allocates some memory very high up in System RAM (eg 0x7373a6f8 on one run). (I have the ICD of the device,...

What is mean by reference in .net wrt CLR (managing objects)?

What is mean by reference in .net wrt CLR (managing objects)? ...

Please clarify my understanding regarding object and reference and value type is current?

Please clarify my understanding regarding object and reference and value type is current? Object means a memory location in RAM where we allocate memory while executing a program Reference means a location(address) in the memory. Passing by reference means - we are passing or pointing a memory location to the function to take the valu...

How to debug a strange memory leak ( C++ )

I'm writing a linux deamon and as for now it works pretty well, but it leaks memory ( and it's bad - after few hours it segfaults after using 60% of the system's memory). The strange thing is, that I'm using only new/delete operators and have a try/catch block around the main function, so it's not an exception thrown by new - it just seg...

Releasing an Array Object.

According to Instruments analysis, I have a memory leak here - and - I'm unsure as to how to properly release the scoresArray object that I have created. This code does work properly, apart from the leakage. I release the highScoresArray object later in the code - but attempts to release the scoresArray kill the app. I thought that whe...

How does the delete in C++ know how many memory locations to delete

how does the delete operator work? Is it better then free()?. Also if u do ptr=new char[10], then delete using delete ptr, how does the pointer know how many locations to delete. ...