Click here to Skip to main content
15,881,044 members
Home / Discussions / C#
   

C#

 
AnswerRe: Date Conversion Pin
PIEBALDconsult18-Aug-07 10:05
mvePIEBALDconsult18-Aug-07 10:05 
Questionhow to send a complex message in msmq [modified] Pin
zencer17-Aug-07 18:43
zencer17-Aug-07 18:43 
Questioncomparing two versions of the same document side-by-side graphically Pin
vkponugoti17-Aug-07 16:28
vkponugoti17-Aug-07 16:28 
Questiongraphics in C# Pin
shaikhooo17-Aug-07 14:23
shaikhooo17-Aug-07 14:23 
AnswerRe: graphics in C# Pin
Luc Pattyn17-Aug-07 14:33
sitebuilderLuc Pattyn17-Aug-07 14:33 
QuestionRole based security Pin
MBursill17-Aug-07 13:39
MBursill17-Aug-07 13:39 
QuestionHandling large blocks of memory in C# Pin
sbpont17-Aug-07 11:40
sbpont17-Aug-07 11:40 
AnswerRe: Handling large blocks of memory in C# Pin
Luc Pattyn17-Aug-07 11:46
sitebuilderLuc Pattyn17-Aug-07 11:46 
Hi,

I think you are completely wrong about this; if you create an object, you
allocate some memory and get a reference, that's what the "new" keyword does for you.
Think of the reference as a pointer, if that suits you.

You now can copy that reference, you now have to variables referencing the same
object; no data got copied, it is just the pointer value that got copied.

You can store a reference in a collection (an array, a List, a Queue, whatever),
that does not move any data, it simply copies the pointer.

Things would be different if you were to serialize your object, e.g. because
you want to pass it to another AppDomain, or to another machine entirely.
But as long as your object stays inside an AppDomain, no data gets copied.

As a final test, you can do the following:

byte[] bigArray=new byte[100*1024*1024];  // that's 100 MB
ArrayList list=new ArrayList();
for (int i=0; i<1000; i++) list.Add(bigArray);


The above creates a 100MB array, then stores it 1000 times in a list.
Did that require 100GB of RAM?
Run it with a stopwatch; could you get that amount of data copied in that short
a time?
Don't think so.

Smile | :)



Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


AnswerRe: Handling large blocks of memory in C# Pin
Guffa17-Aug-07 12:37
Guffa17-Aug-07 12:37 
QuestionPrint contents of a textbox Pin
LCI17-Aug-07 10:25
LCI17-Aug-07 10:25 
QuestionSystem Language Pin
Thaer Hamael17-Aug-07 10:00
Thaer Hamael17-Aug-07 10:00 
AnswerRe: System Language Pin
snorkie17-Aug-07 10:19
professionalsnorkie17-Aug-07 10:19 
QuestionLicensing Software Pin
snorkie17-Aug-07 8:08
professionalsnorkie17-Aug-07 8:08 
AnswerRe: Licensing Software Pin
Luc Pattyn17-Aug-07 8:30
sitebuilderLuc Pattyn17-Aug-07 8:30 
GeneralRe: Licensing Software Pin
snorkie17-Aug-07 8:46
professionalsnorkie17-Aug-07 8:46 
GeneralRe: Licensing Software Pin
Luc Pattyn17-Aug-07 9:11
sitebuilderLuc Pattyn17-Aug-07 9:11 
QuestionQuestion in Maths Operator? Pin
Khoramdin17-Aug-07 7:57
Khoramdin17-Aug-07 7:57 
AnswerRe: Question in Maths Operator? Pin
Hessam Jalali17-Aug-07 8:02
Hessam Jalali17-Aug-07 8:02 
GeneralRe: Question in Maths Operator? Pin
Luc Pattyn17-Aug-07 8:20
sitebuilderLuc Pattyn17-Aug-07 8:20 
Questionrunat="server" Pin
TAREQ F ABUZUHRI17-Aug-07 7:06
TAREQ F ABUZUHRI17-Aug-07 7:06 
AnswerRe: runat="server" Pin
TAREQ F ABUZUHRI17-Aug-07 7:06
TAREQ F ABUZUHRI17-Aug-07 7:06 
AnswerRe: runat="server" Pin
Guffa17-Aug-07 7:21
Guffa17-Aug-07 7:21 
Questionhelp Pin
chehreghany17-Aug-07 6:52
chehreghany17-Aug-07 6:52 
AnswerRe: help Pin
led mike17-Aug-07 7:04
led mike17-Aug-07 7:04 
GeneralRe: help Pin
Luc Pattyn17-Aug-07 7:42
sitebuilderLuc Pattyn17-Aug-07 7:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.