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

C#

 
QuestionSorting data using BindingSource.Sort Pin
Alessandra7720-Apr-08 4:04
Alessandra7720-Apr-08 4:04 
QuestionOutofMemoryException Pin
Ian Grech20-Apr-08 2:57
Ian Grech20-Apr-08 2:57 
GeneralRe: OutofMemoryException Pin
Luc Pattyn20-Apr-08 3:10
sitebuilderLuc Pattyn20-Apr-08 3:10 
GeneralRe: OutofMemoryException Pin
Jordanwb20-Apr-08 4:09
Jordanwb20-Apr-08 4:09 
GeneralRe: OutofMemoryException Pin
Luc Pattyn20-Apr-08 13:08
sitebuilderLuc Pattyn20-Apr-08 13:08 
GeneralRe: OutofMemoryException Pin
Jordanwb20-Apr-08 13:24
Jordanwb20-Apr-08 13:24 
GeneralRe: OutofMemoryException Pin
Luc Pattyn20-Apr-08 14:07
sitebuilderLuc Pattyn20-Apr-08 14:07 
GeneralRe: OutofMemoryException Pin
Jordanwb20-Apr-08 15:46
Jordanwb20-Apr-08 15:46 
Luc Pattyn wrote:
the OP and my first reply were about boxing, and how it turns a little bool into a full-fledged object.


Gotcha

Luc Pattyn wrote:
I am convinced the smallest amount of information you can store is a bit, and nowadays 8 of them typically fit into a byte. And most microprocessors have assembly instructions to operate on a single bit into a larger memory byte or word.


You are correct, but this limitation is not artifical. When you create a bool type variable in memory you allocate a complete byte to it even though you're using only one bit of data for the actual value. The other 7 bits are completly wasted and you can't use them again until the bool is destroyed by garbage collection. For example: In my compuer I have ~1280 MB (1.25 GB) of RAM. That means that I can have a maximum of 2061584302080 bools (1280 * 1024 * 1024), not 16492674416640 (1280 * 1024 * 1024 * 8) [Re-reads your message] I think we're both saying the same thing but in a very different manner.

Luc Pattyn wrote:
But I am a bit puzzled how all of this became relevant in this thread.


It's relevant because we're talking about OutOfMemoryExceptions. The dude is using to much memory and he doesn't know why. A few weeks ago I had a near exact problem. He was creating a Dictionary that - I assume - maps a key to a value. He had 2147483647 records in the dictionary. 2147483647 Int's each using four bytes equates to ~8 GB of RAM. Don't forget the space that bools take up which is 2147483647 bools each taking a byte / 1024 / 1024 equates to ~2 GB. He wants 10 Gigs of Memory.
GeneralRe: OutofMemoryException Pin
Ian Grech20-Apr-08 23:40
Ian Grech20-Apr-08 23:40 
GeneralRe: OutofMemoryException Pin
Ian Grech22-Apr-08 22:14
Ian Grech22-Apr-08 22:14 
AnswerRe: OutofMemoryException Pin
Ian Grech28-Apr-08 10:52
Ian Grech28-Apr-08 10:52 
GeneralRe: OutofMemoryException Pin
Scott Dorman20-Apr-08 4:42
professionalScott Dorman20-Apr-08 4:42 
GeneralRe: OutofMemoryException Pin
Ian Grech20-Apr-08 23:24
Ian Grech20-Apr-08 23:24 
GeneralRe: OutofMemoryException Pin
Jordanwb21-Apr-08 2:39
Jordanwb21-Apr-08 2:39 
GeneralRe: OutofMemoryException Pin
Scott Dorman22-Apr-08 16:58
professionalScott Dorman22-Apr-08 16:58 
GeneralSystem.CodeDom Problem. Pin
hdv21219-Apr-08 22:55
hdv21219-Apr-08 22:55 
GeneralRe: System.CodeDom Problem. Pin
Rob Smiley20-Apr-08 0:46
Rob Smiley20-Apr-08 0:46 
GeneralUnable to fill certain fields inside the DOM of some websites! Pin
alon198019-Apr-08 21:50
alon198019-Apr-08 21:50 
GeneralRe: Unable to fill certain fields inside the DOM of some websites! Pin
alon198021-Apr-08 4:36
alon198021-Apr-08 4:36 
GeneralFinalizer implementation Pin
George_George19-Apr-08 21:20
George_George19-Apr-08 21:20 
GeneralRe: Finalizer implementation Pin
Scott Dorman20-Apr-08 4:57
professionalScott Dorman20-Apr-08 4:57 
GeneralRe: Finalizer implementation Pin
carbon_golem20-Apr-08 5:29
carbon_golem20-Apr-08 5:29 
GeneralRe: Finalizer implementation Pin
George_George20-Apr-08 17:38
George_George20-Apr-08 17:38 
GeneralRe: Finalizer implementation Pin
carbon_golem21-Apr-08 1:53
carbon_golem21-Apr-08 1:53 
GeneralRe: Finalizer implementation Pin
George_George21-Apr-08 2:07
George_George21-Apr-08 2:07 

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.