Hi,
I need help with a couple of questions, I have create and structure like:
Structure byteArray
Public byteA() As Byte
End Structure
Public ptrArray() As byteArray
I have redim ptrArray(100000 0) and the memory usage in Windows Task Manager
shows an increase of 4MB bytes that seems OK.
Then I have done
for intI=1 to 1000000
Redim ptrArray(intI). byteA(1)
next intI
And now the memory in task manager shows and increase of almost 16 MB,
instead of 1MB.
QUESTIONS:
1) It seems that an structure increase the memory usage (I suppose it create
internal variables). Is there any other way that I can have an "Array of
Arrays" that can be dinamically increase without the memory overcost of
using a structure?.
2) Is ther any way (not Windows Task Manager) to know how much memory a
variable, or structure is using in vb.net?.
Thanks,
James 2 1959
"James" <in**@pricetech .es> schrieb Hi,
I need help with a couple of questions, I have create and structure like: Structure byteArray Public byteA() As Byte
End Structure
Public ptrArray() As byteArray
I have redim ptrArray(100000 0) and the memory usage in Windows Task Manager shows an increase of 4MB bytes that seems OK.
Then I have done
for intI=1 to 1000000
Redim ptrArray(intI). byteA(1)
next intI
And now the memory in task manager shows and increase of almost 16 MB, instead of 1MB.
You probably mean 2 MB because arrays are zero-based, and an upper bound of
1 creates the items 0 and 1.
QUESTIONS:
1) It seems that an structure increase the memory usage (I suppose it create internal variables). Is there any other way that I can have an "Array of Arrays" that can be dinamically increase without the memory overcost of using a structure?.
I don't know if it solves the memory issue, but and array of arrays can be
declared this way:
Public ptrArray()() As byte
This is an array of byte-arrays.
Public ptrArray(999999 )() As byte
This is an array that can point to 1,000,000 byte arrays. Each of the 1 mio.
items is still Nothing.
Redim ptrArray(0)(99)
Now Item 0 points to an array of 100 bytes.
2) Is ther any way (not Windows Task Manager) to know how much memory a variable, or structure is using in vb.net?.
I have no reliable answer to this. I can only point to
VB language reference -> data types -> data type summary.
There are few words about the memory consumption of arrays - maybe this
helps. Using that information: 1,000,000 * (12 + 8 + 2) = ~22 MB. But as I
said, I can not say this for sure, above all because the automatic memory
management is a "black box". Maybe you can ask this in the
microsoft.publi c.dotnet.framew ork.clr group because it is not really VB.Net
related.
Armin
"James" <in**@pricetech .es> schrieb: 2) Is ther any way (not Windows Task Manager) to know how much memory a variable, or structure is using in vb.net?.
In addition to the other replies:
Allocation Profiler src
<URL:http://www.gotdotnet.c om/Community/UserSamples/Details.aspx?Sa mpleGuid=325432 5d-a4aa-4bb3-aa86-c72d5104ec74>
CLR Profiler (v2.0)
<URL:http://www.microsoft.c om/downloads/details.aspx?Fa milyId=86CE6052-D7F4-4AEB-9B7A-94635BEEBDDA&di splaylang=en>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tomvr |
last post by:
Hello
I have noticed some 'weird' memory usage in a vb.net windows app
The situation is as follows
I have an app (heavy on images) with 2 forms
(actually there are more forms and on starting the app I load some things into memory for global use of the app but I'll use only 2 starting forms to explain the situation)
situation 1
start app with form 1 (72mb memory usage), show form 2 and hide form 1 (89 mb memory usage
|
by: Tom |
last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB
Memory Footprint. It starts a window runs a process and does a regular
expression. I have done a GC.Collect to make sure that, no memory is
lying around. GC reports only 84k of allocations. Starting 5-10 of
this apps is going to start taking a considerable amount of memory. Is
there a way to reduce this?
Tom
|
by: Ian Taite |
last post by:
Hello,
I'm exploring why one of my C# .NET apps has "high" memory usage, and
whether I can reduce the memory usage.
I have an app that wakes up and processes text files into a database
periodically. What happens, is that the app reads the contents of a
text file line by line into an ArrayList. Each element of the ArrayList
is a string representing a record from the file. The ArrayList is then
processed, and the arraylist goes out of...
|
by: simon |
last post by:
From my previous post...
If I have a structure,
struct sFileData
{
char*sSomeString1;
char*sSomeString2;
int iSomeNum1;
int iSomeNum2;
|
by: Brett |
last post by:
I have created a structure with five fields. I then create an array of this
type of structure and place the structure into an array element. Say index
one. I want to assign a value to field3 of the structure inside the array.
When I try this, an error about late assignment appears. Is it possible to
assign a value to a structure field that is in an array?
I'm currently getting around the problem by creating a new structure, assign...
| |
by: zhphust |
last post by:
I want to convert a object of a managed class to a unmanaged structure
that has the same member with that managed class. Can anybody tell me
how i can do it?
Thanks in advance.
--
zhphust
------------------------------------------------------------------------
|
by: James |
last post by:
I am using vb.net and need to keep in memory a large data structure, so I am
looking for the best option. And after several test I am pretty confused. So
I will be grateful if anyone can help me.
My basic need is:
|
by: SP |
last post by:
The following code crashes after I add the two nested FOR loops at the
end, I am starting to learn about pointers and would like to understand
what I'm doing wrong. I think the problem is the way I access the
array elements.
Thanks for your help.
#include <stdio.h>
|
by: Jean-Paul Calderone |
last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote:
The test doesn't demonstrate any leaks. It does demonstrate that memory
usage can remain at or near peak memory usage even after the objects for
which that memory was allocated are no longer live in the process. This
is only a leak if peak memory goes up again each time you create any new
objects. Try repeated allocations of a large dictionary and observe how
memory...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |