Click here to Skip to main content
15,896,453 members
Home / Discussions / C#
   

C#

 
QuestionSalted hash - Storing Salt In password or a seperate field [modified] Pin
DotNetWWW18-Sep-08 6:41
DotNetWWW18-Sep-08 6:41 
AnswerRe: Salted hash - Storing Salt In password or a seperate field Pin
N a v a n e e t h18-Sep-08 7:12
N a v a n e e t h18-Sep-08 7:12 
GeneralRe: Salted hash - Storing Salt In password or a seperate field Pin
Paul Conrad18-Sep-08 7:48
professionalPaul Conrad18-Sep-08 7:48 
GeneralRe: Salted hash - Storing Salt In password or a seperate field Pin
DotNetWWW18-Sep-08 8:51
DotNetWWW18-Sep-08 8:51 
GeneralRe: Salted hash - Storing Salt In password or a seperate field Pin
N a v a n e e t h18-Sep-08 18:20
N a v a n e e t h18-Sep-08 18:20 
AnswerRe: Salted hash - Storing Salt In password or a seperate field Pin
Paul Conrad18-Sep-08 7:49
professionalPaul Conrad18-Sep-08 7:49 
AnswerRe: Salted hash - Storing Salt In password or a seperate field Pin
Guffa18-Sep-08 9:33
Guffa18-Sep-08 9:33 
QuestionWhere's my (computer's) memory gone? Pin
Rob Philpott18-Sep-08 5:32
Rob Philpott18-Sep-08 5:32 
What's going on here then?

public struct Bobbins
{
	public int X;
}

class Program
{
	static void Main(string[] args)
	{
		Bobbins[] memory = new Bobbins[100000000];
		for (int index = 0; index < memory.Length; index++)
		{
			memory[index] = new Bobbins();
		}
		Console.ReadLine();
	}
}


So here I create an array containing 100 million bobbins structs. I know the for loop isn't necessary but it will be in a minute. 700ms later the program is waiting for me to hit enter and task manager tells me its taking up 400 million bytes of memory. This is good; I like this. My struct contains just an integer of 4 bytes, there's 100 million of them so it all adds up.

Now, if I change bobbins from a struct to a class, I'd expect the memory to double. My class should still be 4 bytes in length and my array now contains 4 byte references to the class (instance). 8 bytes per array element. Infact, 16 seconds after running the application My memory usage is 1.6GB, a total of 16 bytes per element.

Don't get it. Is there some overhead in size on classes?

Regards,
Rob Philpott.

AnswerRe: Where's my (computer's) memory gone? Pin
Mark Salsbery18-Sep-08 6:41
Mark Salsbery18-Sep-08 6:41 
AnswerRe: Where's my (computer's) memory gone? Pin
Alan N18-Sep-08 6:52
Alan N18-Sep-08 6:52 
GeneralRe: Where's my (computer's) memory gone? Pin
Rob Philpott18-Sep-08 6:58
Rob Philpott18-Sep-08 6:58 
Questioninsight on data recording to msaccess Pin
djjedi18-Sep-08 5:16
djjedi18-Sep-08 5:16 
QuestionHow to Compare the two database tables(table1,Table2) and update the difference into (table2) using c# Pin
bruze18-Sep-08 5:08
bruze18-Sep-08 5:08 
QuestionSetting selected controls programatically. Pin
djjedi18-Sep-08 5:08
djjedi18-Sep-08 5:08 
AnswerRe: Setting selected controls programatically. Pin
Alan N18-Sep-08 7:23
Alan N18-Sep-08 7:23 
Question64-bit Programming Pin
HosamAly18-Sep-08 5:00
HosamAly18-Sep-08 5:00 
AnswerRe: 64-bit Programming Pin
Giorgi Dalakishvili18-Sep-08 5:04
mentorGiorgi Dalakishvili18-Sep-08 5:04 
Questionhow can i increse the size of the picture box with picture? Pin
maifs18-Sep-08 4:18
maifs18-Sep-08 4:18 
AnswerRe: how can i increse the size of the picture box with picture? Pin
Mbah Dhaim18-Sep-08 4:27
Mbah Dhaim18-Sep-08 4:27 
AnswerRe: how can i increse the size of the picture box with picture? Pin
nelsonpaixao18-Sep-08 13:58
nelsonpaixao18-Sep-08 13:58 
Questionhow can i increase the font size which is written in text box.. Pin
maifs18-Sep-08 4:11
maifs18-Sep-08 4:11 
AnswerRe: how can i increase the font size which is written in text box.. Pin
GuruPrasadh18-Sep-08 10:26
GuruPrasadh18-Sep-08 10:26 
Questionc# caching of sql query Pin
swjam18-Sep-08 3:53
swjam18-Sep-08 3:53 
AnswerRe: c# caching of sql query Pin
Simon P Stevens18-Sep-08 4:05
Simon P Stevens18-Sep-08 4:05 
GeneralRe: c# caching of sql query [modified] Pin
Mbah Dhaim18-Sep-08 4:17
Mbah Dhaim18-Sep-08 4:17 

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.