28
голосов
7ответов
58584 просмотров

Memory usage of current process in C

I need to get the memory usage of the current process in C. Can someone offer a code sample of how to do this on a Linux platform? I'm aware of the cat /proc/<your pid>/status method of getting memory usage, but I have no idea how to capture that in C. BTW, it's for a PHP extension I'm mo...

1
голосов
3ответов
1561 просмотров

Meaning of "@far int* @near IntegerPointer;"

I have the following definition. far int* near IntegerPointer; Does this mean, a pointer placed in 'near' memory pointing to a integer placed in far memory area. Can anyone please clarify.

37
голосов
5ответов
27631 просмотров

Create new C++ object at specific memory address?

Is it possible in C++ to create a new object at a specific memory location? I have a block of shared memory in which I would like to create an object. Is this possible?

0
голосов
3ответов
1524 просмотров

How to control the memory usage of processes spawned by a JVM

I am coding an application that creates JVMs and needs to control the memory usage of the processes spawned by the JVM.

2
голосов
2ответов
473 просмотров

Memory issue in C#, normal use if dll is called by .Net app but astronomical if dll called from legacy app

I have created dll in C# 3.5 which does some memory intensive matrix calculations where matrices get created and disposed a lot. Everything works fine if dll is called from .Net app but if it is called from C++ created app memory usage just climbs until the function that uses matrices is done. I ...

22
голосов
9ответов
14853 просмотров

Why would you ever want to allocate memory on the heap rather than the stack?

Possible Duplicate: When is it best to use a Stack instead of a Heap and vice versa? I've read a few of the other questions regarding the heap vs stack, but they seem to focus more on what the heap/stack do rather than why you would use them. It seems to me that stack allocation would a...

2
голосов
2ответов
2128 просмотров

Does a one cycle instruction take one cycle, even if RAM is slow?

I am using an embedded RISC processor. There is one basic thing I have a problem figuring out. The CPU manual clearly states that the instruction ld r1, [p1] (in C: r1 = *p1) takes one cycle. Size of register r1 is 32 bits. However, the memory bus is only 16 bits wide. So how can it fetch all da...

0
голосов
1ответов
683 просмотров

UITabViewController memory management

I have an app which consists multiple tabs managed by the class derived from UITabBarController (the only reason I subclassed UITabBarConteroller is to handle shake event for all views). 3 views are from subclassed UIViewContentroller class, one view is UINavigationController which shows a table....

7
голосов
8ответов
12230 просмотров

How are bits stored in memory? (In chunks? Can there be bits of multiple sizes stored toghether?)

I used to think that each memory location contains 8, 16, 32 or 64 bits. So 0101 would be stored in an 8 bit machine as 00000101 (sign extended if it was negative). This was all fine and dandy until I wrote a program in java out of curiosity to find out some more inner workings of this system. ...

1
голосов
6ответов
497 просмотров

Should I load everything in memory upon application start?

I'm using VB.Net, and I have a set of data which I have to able to filter through fairly quickly. Basically, the program is like google sugest, but instead of a drop-down menu, I'm using a listbox. When a user enters a word, I compare the word using LINQ and filter those that contain the user's i...

1
голосов
3ответов
1252 просмотров

Reading from SerialPort & Memory Management - C#

I am working on a program that reads in from a serial port, then parses, formats, and displays the information appropriately. This program, however, needs to be run for upwards of 12+ hours - constantly handling a stream of incoming data. I am finding that as I let my app run for a while, the mem...

0
голосов
7ответов
258 просмотров

pointers and references question

#ifndef DELETE #define DELETE(var) delete var, var = NULL #endif using namespace std; class Teste { private: Teste *_Z; public: Teste(){ AnyNum = 5; _Z = NULL; } ~Teste(){ if (_Z != NULL) DELETE(_Z); } Teste *Z(){ ...

5
голосов
8ответов
1164 просмотров

Are .NET Applications naturally memory intensive?

I started to write a large application in C# for the first time in my life. I wrote sample module to test the idea behind my software. This module contained several dozen C# dictionaries and lists of objects that each had several members and properties. I was shocked that after initializing co...

4
голосов
4ответов
2297 просмотров

How do you limit PHP memory usage when processing MySQL query results?

So I have a PHP page that allows users to download CSV for what could be a whole bunch of records. The problem is the more results the MySQL query returns, the more memory it uses. That's not really surprising, but it does pose a problem. I tried using mysql_unbuffered_query() but that didn't ma...

8
голосов
1ответов
8175 просмотров

How to dispose a Writeable Bitmap? (WPF)

Some time ago i posted a question related to a WriteableBitmap memory leak, and though I received wonderful tips related to the problem, I still think there is a serious bug / (mistake made by me) / (Confusion) / (some other thing) here. So, here is my problem again: Suppose we have a WPF appli...

3
голосов
2ответов
1351 просмотров

Jquery + Chrome memory issue

I'm running this script in Google Chrome while using the Chrome Task Manager to monitor memory usage: <html> <head> <title>Test Page</title> <script type="text/javascript" src="jquery-1.3.2.js"></script> <script type="text/javascript"> ...

2
голосов
2ответов
88 просмотров

Copying data from a running ruby script

I have a long running ruby script, in Linux, which has some interesting data stored in a hash table. The program does not have any persistence mechanism and I am interested in copying the data from it's hash table. Is there any way to copy data from the memory of a running ruby script? raj

1
голосов
3ответов
185 просмотров

Clearing up large fields from memory in long lived objects

.NET 3.5, I've got some classes which stores up to 1MB of strings. Even though I need the object for a really long time I don't need to store the string for a long time. How can I truly remove the string from memory without disposing the parent object. Is it a good practice to use "myString = ...

0
голосов
3ответов
161 просмотров

Large Memory Usage on Small Server (Optimization Question)

I have an application that analyzes data from input files that are generated by our core system. Depending on the client, that file can vary in size (files contain online marketing metrics such as clicks, impressions, etc..). One of our clients has a website that gets a fairly large amount of t...

0
голосов
2ответов
228 просмотров

Memory issue in iPhone OS (shorter version)

I'm facing some sort of memory related issue I cannot figure out. I have one summary view that lists some settings and a detail view where you can edit each setting. In the summary view I have a tableview populated by an array (settingArray) of settings which in turn is loaded from a core data ...

1
голосов
1ответов
3543 просмотров

Is it possible to call GC in Android?

I am wondering if there is a way to call gc from code, hopefully to free some memory.

7
голосов
6ответов
5302 просмотров

Memory usage, SortedList vs List problem

I was using SortedList() in a class which stores about 15-100K data. Recently my requirements changed, data should not be stored as sorted any more so I switched to List(). However in this case I noticed that List() consumes about 20%+ more memory. 9K items: SortedList: 105MB List: 125MB ...

3
голосов
2ответов
850 просмотров

What Determines Memory Usage on Ubuntu with Rails and MySQL

Forgive the newbie type question but, what determines the RAM consumed by rails and MySQL (my server is Ubuntu)? With barely any requests coming in the server seems to be hovering around 1.5 of 2GB. MySQL has about 100MB of data stored in it. The site has about 3500 registered users and when tr...

2
голосов
2ответов
1520 просмотров

Sharing Memory Between CGImageRef and UIImage

Is there any way to create a UIImage object from an offscreen surface without copying the underlying pixel data? I would like to do something like this: // These numbers are made up obviously... CGContextRef offscreenContext = MyCreateBitmapContext(width, height); // Draw into the offscreen bu...

0
голосов
2ответов
122 просмотров

Under what conditions can the object at an address change? (obj-c)

I have a controller with a delegate. @interface MyConversionController : NSObject { id <ConversionDelegate> _delegate; } @property (assign) id delegate; @end @implementation @synthesize delegate = _delegate; @end I'm getting Unrecognized selector sent to instance 0x36c4a0 errors...

2
голосов
3ответов
241 просмотров

Adobe Flex App page file usage going through the roof!

I have been working on an Adobe Flex application for some months now, and the application is meant to run 24/7 for days (weeks!) continuously. However, I'm now seeing that after a few days of running nonstop the computer it runs on tells me that the system is low on virtual memory and gives me a...

1
голосов
4ответов
1894 просмотров

PHP using too much memory

I'm getting the following error when trying to run a php script I wrote: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 56320 bytes) in /home/evergrf2/public_html/ianburris/p/maptile/mapfetcher.php on line 43 What confuses me is that it says the allo...

1
голосов
2ответов
731 просмотров

Is this an efficient use of UIImage?

Let's say I have an object called Person. Person internally loaded an UIImage called "person.png". In my app i create many Person objects, creating and even deleting them at runtime. Since a Person object internally has a retained reference to UIImage, does this mean each Person has a unique me...

9
голосов
1ответов
374 просмотров

Guidance on optimising Python runtime for embedded systems with low system resources

My team is incorporating the Python 2.4.4 runtime into our project in order to leverage some externally developed functionality. Our platform has a 450Mhz SH4 application core and limited memory for use by the Python runtime and application. We have ported Python, but initial testing has high...

5
голосов
4ответов
18802 просмотров

strtok and memory leaks

I wrote a simple url parser using strtok(). here's the code #include <stdio.h> #include <stdlib.h> typedef struct { char *protocol; char *host; int port; char *path; } aUrl; void parse_url(char *url, aUrl *ret) { printf("Parsing %s\n", url); char *tmp = (c...