memory

Handling large amount of structures in MATLAB

I need to handle massive (tens of millions) of MATLAB structs; I needed a dozen or so fields so I reckoned memory won't be an issue, until I discovered this ( explanation ) >> s=[]; >> s.first=1; >> whos Name Size Bytes Class Attributes s 1x1 132 struct >> s.second=2; >> wh...

Outputting to stderr whenever malloc/free is called

With Linux/GCC/C++, I'd like to record something to stderr whenever malloc/free/new/delete are called. I'm trying to understand a library's memory allocations, and so I'd like to generate this output while I'm running unit tests. I use valgrind for mem leak detection, but I can't find an option to make it just log allocations. Any i...

Using sprintf without a manually allocated buffer

In the application that I am working on, the logging facility makes use of sprintf to format the text that gets written to file. So, something like: char buffer[512]; sprintf(buffer, ... ); This sometimes causes problems when the message that gets sent in becomes too big for the manually allocated buffer. Is there a way to get sprint...

Why is PHP Doctine's free() not working?

This is one is for any of you Doctrine users out there. I have a PHP CLI daemon process that checks a table every n seconds to find entries that haven't been processed. It's basically a FIFO. Anyways, I always exceed the memory allocated to PHP becuase Doctrine does not free it's resources. To combat this problem it provides free for...

Why does this leak?

Why does this leak in Perl ? $ perl -MDevel::LeakTrace::Fast -e 'our @a=(1);our @b=(1)' leaked SV(0x0x84e053c) from -e line 1 $ perl -v This is perl, v5.8.0 built for i386-linux-thread-multi [...] $ uname -a Linux ant1 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT 2004 i686 i686 i386 GNU/Linux Thanks! ...

What is the purpose of allocating pages in the pagefile with CreateFileMapping?

The function CreateFileMapping can be used to allocate space in the pagefile (if the first argument is INVALID_HANDLE_VALUE). The allocated space can later be memory mapped into the process virtual address space. Why would I want to do this instead of using just VirtualAlloc? It seems that both functions do almost the same thing. Mem...

Weak references

can someone explain the main benefits of different types of references in C#, weak references, soft references, phantom references, strong references. We have an application that is consuming a lot of memory and we are trying to determine if this is an area to focus on. ...

Best resource for memory footprint analysis for winforms app . .

So we have a winforms app that in the task manager should anywhere from 250 - 450 MB of memory. We are trying to figure out the best place to focus on to reduce memory footprint. what is the best place to start? ...

What is the best way to track and lower GD handles?

what is the best way to track and lower GDI windows handles . . ...

resize a vector down.. c++

I have a vector with 1000 "nodes" if(count + 1 > m_listItems.capacity()) m_listItems.reserve(count + 100); The problem is I also clear it out when I'm about to refill it. m_listItems.clear(); The capacity doesn't change. I've used the resize(1); but that doesn't seem to alter the capacity. So how does one change the reserv...

Updating from Java VM 5 to 6 gave a really big increase of memory consumption

Hi, I've be working with a Java application run through the command-line. It deals with XML files, specially the dblp.xml database which has more than 400MB. I was using JVM 5 and my app needed sort of 600-700MB of memory to processe the dblp.xml. After updating to JVM 6, it starting needing more than 1gb of memory (something I don't h...

Declaring Dynamic Memory Statements C++

Hi if I am creating something on the stack using new I declare it like: object *myObject = new object(contr, params); Is there a way to declare this such as: object *myObject; myObject = new object(constr, params); Is this correct? ...

Java: Memory Allocation For Objects

Please enlighten me. public class SomeObject{ private String strSomeProperty; public SomeObject(String strSomeProperty){ this.strSomeProperty = strSomeProperty; } public void setSomeProperty(String strSomeProperty){ this.strSomeProperty = strSomeProperty; } public String getSomeProperty(){ retur...

Configure SQL Server 2000 to use more than 2Gb of memory on a 64bit server

Is there any way to configure SQL Server 2000 Standard Edition (32 bit) to use more than 2Gb of memory on a server running Windows 2003 (64 bit)? Thanks for any help. ...

intel compiler on vista: "unable to obtained mapped memory"

Hi all, I'm getting the following error when trying to compile C++ projects using intel compiler version 10.0.025 on vista business edition (sp1) in vs2008: unable to obtain mapped memory (see pch_diag.txt) There is no such file as pch_diag, so that's a bit disheartening. If I try to just use the microsoft compiler, all of my call...

What's the deal with NSZoneFree in -(void)dealloc?

In Apple's NSObject documentation, NSZoneFree is called in the - (void)dealloc example code: - (void)dealloc { [companion release]; NSZoneFree(private, [self zone]) [super dealloc]; } You can find it in context over here. I never had the notion that I should be calling NSZoneFree in my own NSObject subclasses (or what NS_...

Memory Efficient Alternatives to Python Dictionaries

In one of my current side projects, I am scanning through some text looking at the frequency of word triplets. In my first go at it, I used the default dictionary three levels deep. In other words, topDictionary[word1][word2][word3] returns the number of times these words appear in the text, topdictionary[word1][word2] returns a dictio...

Identifying memory problems in an ASP.NET application

Hey, I've got an ASP.NET application running and on the production box it's using about 450MB RAM, however, it shouldn't be using quite so much, and it seems to increase over time, so it seems there might be a leak or atleast something not being released properly. I took a look with PerfMon and there was 416MB in GC Gen2. Anyone hav...

Can Silverlight 2.0 pages be removed from a collection manually (garbage collected)?

I have multiple xaml based pages stored as children of a canvas on another page. I add and remove the children pages as the application runs. However, pages that are removed from the children collection are still running and respond to keyboard shortcuts. How can I force the older pages to be removed completely? ...

Since .NET has a garbage collector why do we need finalizers/destructors/dispose-pattern?

If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied. Since this is the case why then do some objects need to have a destructor or dispose method? Won’t the runtime clean up af...