I have a list of tuples.
[
"Bob": 3,
"Alice": 2,
"Jane": 1,
]
When incrementing the counts
"Alice" += 2
the order should be maintained:
[
"Alice": 4,
"Bob": 3,
"Jane": 1,
]
When all is in memory there rather simple ways (some more or some less) to efficiently implement this. (using an index, insert-sort etc) The que...
I appear to have created code that is trashing memory.
Having never had such problems before, i am now settign an Invalid Pointer Operation.
In the following the value of the const string sFilename gets trashed after my call to PromptForXYZPropertiesSettings.
// Allow the user to quickly display the properties of XYZ without needing t...
Hi,
I've got a Red Hat box with 6G memory running Tomcat and I'm trying to figure out how much memory I have left on the box. Problem is, top & jconsole is showing one figure (around 200M), and system monitor is showing a different figure (around 2G). Does anybody know what the difference is?
I'm not sure if there is a memory leak happ...
Hi All,
Please find below the description of memory leaks issues.
Statistics show major growth in the perm area (static classes).
Flows were ran for 8 hours , Heap dump was taken after 2 hours and at
the end. A growth in Perm area was identified
Statistics show from our last run 240MB growth in 6 hour,40mb
growth every hour 2GB...
In several pieces of sample objective-c code I've seen people create new objects like this:
RootViewController *viewController = [[RootViewController alloc] init];
self.rootViewController = viewController; // self.rootViewController is a (nonatomic,retain) synthesized property
[viewController release];
[window addSubview: [self.rootVie...
Quick and simple question.
There are examples online about achieving in-memory gzip compression with zlib (C++) WITHOUT external libraries (like boost or such)?
I just need to compress and decompress a block of data without much options. (it must be gzip as its the same format used by another mine C# program (the data is to be shared)...
Hi.
I have an UIWebView that loads a embedded XHTML like this:
body = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
body.scalesPageToFit = YES;
body.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
body.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin...
When I run this code:
#include <stdio.h>
typedef struct _Food
{
char name [128];
} Food;
int
main (int argc, char **argv)
{
Food *food;
food = (Food*) malloc (sizeof (Food));
snprintf (food->name, 128, "%s", "Corn");
free (food);
printf ("%d\n", sizeof *food);
printf ("%s\n", food->name);
}
I still get
128
Corn...
Hello All,
I have inherited some code that I need to maintain that can be less than stable at times. The previous people are no longer available to query as to why they ran the application in an environment with unlimited stack set, I am curious what the effects of this could be? The application seems to have some unpredictable memory b...
I have a crawler application (with C#) that downloads pages from web .
The application take more virtual memory ,
even i dispose every object and even use GC.Collect() .
This , have 10 thread and each thread has a socket that downloads pages .
In each thread , i have a byte[] buffer that store content of page , and have
an string str_...
do they exist ?
*added to clarify:
is there any usable library that implement lock-free (which is threadsafe and might be implement spinlock or other lightweight synchronization) ObjectPool ( http://en.wikipedia.org/wiki/Object_pool_pattern ) written in C++ language using template?
...
How serious it might be to NOT unsubscribe from the events in c#?
Is it mandatory or advisable action?
...
I've been using this code to create my UIWindow
UIMyWindow* win = [[UIMyWindow alloc]
initWithFrame:[[UIScreen mainScreen] applicationFrame]];
UIMyWindow isn't anything special it just has a pointer to a C++ class that does some wrapping of ObjectiveC.
Recently my application start crashing after adding some line ...
Hi,
I am changing the image in UIImageView based on accelerometer input. The images are stored in an array.
The application runs fine for a while and then crashes.
warning: check_safe_call: could not restore current frame
I am not using "UIImage ImageNamed" method when populating the array.
The total size of all images is around...
Maybe I need change the title as "Unmanaged Code calling leads to heavy memory leak!"
The leak is around 30M/hour
I think maybe I need complete my code here because the memory leak maybe not from a static string whereas my real code derive this string from external device (see new code attached). so I handle also unmanaged code. Could ...
I use GridView to display thumbnails from MediaStore.
If I launch and close my application 2-3 times it crashes with out of
memory error.
System.gc() is called in onCreate of main activity.
If comment call setImageURI then no errors.
Maybe I need to explicitly clear memory somehow?
Please, help.
public View getView(int position, View...
Hi all,
I have a C++ program that has a pretty terrible memory leak, about 4MB / second. I know where it's coming from and can fix it, but that's not my main problem. My program is taking up a very large amount of CPU usage and it isn't running as fast as I want it to. I have two different threads in the program. One by itself takes ~50...
Consider the following:
ThreadA and ThreadB are two threads writing diagnostic information to a common object which stores a list of diagnostic information. Is it possible for ThreadA and ThreadB to write to the same memory address at the same time? If so what would result?
I'm using .NET however i'm not necessarily interested in one...
I'm trying to get a program I'm writing (in F#, though I would imagine the answer here is the same for any CLR language?) to report on its own memory usage (so I can get an idea of how much I'm stressing the machine, compare sizes of different workloads, and evaluate the effect of any optimizations I do in the hope of saving memory).
Th...
Hey guys, I'm starting to play around with Objective-C and I want to make sure I get memory/properties right.
Suppose the following code:
@interface Rectangle : NSObject
{
Vector2* origin;
//[...]
}
Rectangle* myRect = [[Rectangle alloc] init];
myRect.origin.x = 100.0f;
[myRect print];
myRect.origin = [[Vector2 alloc] init];...