memory

C# word.open() error - Attempted to read or write protected memory

I am trying to open the word document as follows. wordDocument = wordApplication.Documents.Open(ref paramSourceDocPath, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref par...

Struct initialization problem?

Hi, I'm using a struct like this: define struct _Fragment{ int a; char *seq; }Fragment; I want to initialize the struct, and using the malloc() method return a dynamic memory like this Fragment *frag=malloc(10*sizeof(Fragment)); Then I would using the frag pointer like this: frag->seq="01001"; Then the problem occurs...

Meaning of memory related terms?

While playing with memory profiling in delphi, although it applies to any language I've found some terms about used memory which I don't completely understand. Could someone explain (or refer to a good document or manual) the meaning of the following terms? Working set size Pagefile used Committed memory Uncommited memory Private Usage...

C++, statically detect base classes with differing addresses?

If I have a derived class with multiple bases, each this pointer for each base will be different from that of the derived object's this pointer, except for one. Given two types in an inheritance hierarchy, I'd like to detect at compile time whether they share the same this pointer. Something like this should work, but doesn't: BOOST_STA...

Reasons for seeing high" % Time in GC" in Perf Mon

While monitoring our application in Perf Mon I noticed that the % of Time In GC is anywhere from 20 - 60% while our application is performing a long running process (varies between 30 seconds to 1.5 minutes). This seems a bit excessive to me. This raises two important questions. Am I correct that this excessive? Routes I can take to ...

Should a programmer really care about how many and/or how often objects are created in .NET?

This question has been puzzling me for a long time now. I come from a heavy and long C++ background, and since I started programming in C# and dealing with garbage collection I always had the feeling that such 'magic' would come at a cost. I recently started working in a big MMO project written in Java (server side). My main task is to...

Achieving Interface functionality in C++

A big reason why I use OOP is to create code that is easily reusable. For that purpose Java style interfaces are perfect. However, when dealing with C++ I really can't achieve any sort of functionality like interfaces... at least not with ease. I know about pure virtual base classes, but what really ticks me off is that they force me in...

What does python *intern* do, and when should it be used?

I came across this question about memory management of dictionaries, which mentions the intern function. What exactly does it do, and when would it be used? To give an example: If I have a set called seen, that contains tuples in the form (string1,string2), which I use to check for duplicates, would storing (intern(string1),intern(stri...

web page memory usage in firefox

Is there any way to know how much memory current web page is using in Firefox? ...

A question about setter in objective-c

This is an example from The Objective-C 2.0 Programming Language. I was just wondering, in the setter at the bottom, can I use value = [newValue retain] instead of value = [newValue copy] ? @interface MyClass : NSObject { NSString *value; } @property(copy, readwrite) NSString *value; @end // assume using garbage collecti...

What is tiny_free_list_add_ptr?

I've searched far and wide for its meaning. My guess is that I somehow have a corrupt stack. I get tiny _ free_ list_ add_ ptr on the 16th call of the line that says: NSDateFormatter *theFormatter = [[NSDateFormatter alloc] init]; What is the cause of the problem? Am I correct in thinking that I have a corrupt stack? - (NSStr...

How do I free these resources in my iPhone application?

Okay, I have an app that tells me what color of pixel I touched by reading the screen (like a screenshot) after each touch. To retrieve the pixels, I use a method similar to that appearing here. But it seems that after each touch, the image data is still being held on to (and not to mention saving hundreds of unwanted screenshots in my p...

Why does this simple php script leak memory?

In hopes of trying to avoid future memory leaks in php programs (drupal modules, etc.) I've been messing around with simple php scripts that leak memory. Could a php expert help me find what about this script causes the memory usage to continually climb? Try running it yourself, changing various parameters. The results are interesting....

C# List<T>.ToArray performance is bad?

Hello everyone, I am using VSTS 2008 + .Net 3.5 + C#. I heard the performance of C# List.ToArray is bad since what it does is memory copy for all elements to form a new array. Is that true? thanks in advance, George ...

Does "readonly" (C#) reduce memory usage?

In C#, does setting a field as readonly reduce memory usage? i.e. DBRepository _db = new DBRepository(); vs readonly DBRepository _db = new DBRepository(); Just curious. Thanks. ...

JVM Memory Defaults

What is the default Xms and Xmx settings for the Sun JVM (v 1.4*) if those values are not specified at startup? ...

Can I Iimit the memory used by a Perl process in an OS-agnostic way?

Is there an OS-agnostic Perl module that puts a hard limit on the amount of virtual memory a process can use; e.g. so that the process will be killed if it starts eating up too much memory? I see Apache::SizeLimit, which is obviously Apache specific; and Process::MaxSize, which requires you to call a check function (and also has a hacky...

Slab Allocator Performance Comparison

Hi, I'm looking at revamping our malloc() in our operating system kernel. We currently use dlmalloc, but I'd like a homebrew solution that we can edit without having to work on a thousand-line file. I've decided to look into the slab allocator (Bonwick94) and I believe it's the right choice. So far I understand the concept and am ready...

Finding the nearest used index before a specified index in an array (Fast)

This question is related to http://stackoverflow.com/questions/1053242/array-of-pairs-of-3-bit-elements This array has 52 pairs (about 40 bytes), and I want to find the first pair before the specified one that has it's values different from 0 (used pair). The obvious solution would be to check each pair < than this one (scan from right t...

Word VBA Tabstop Problem

Hello, I have the following VBA code Private Sub CreateQuery_Click() Dim doc As Document Dim i As Integer Set doc = ActiveDocument i = doc.Paragraphs.Count doc.Paragraphs(i).Range.InsertParagraphAfter i = i + 1 For j = 0 To 1000 doc.Paragraphs(i).Range.InsertParagraphAfter i = i + 1 doc.Paragraphs(i)...