|
In non technical teams the stack is an optimized memory bank that is very fast. The heap is a memory bank that isn't as fast but great for handling objects of varying sizes. So when you create an object, .NET looks to see if it is a native or reference type. If it is a native type, the value it put on the stack, otherwise it is put on the heap.
The reason for this is that the stack only handles objects that are 32 bits in size. The fact that all memory allocations are the same size is what makes it fast. Also it's not a pointer to a value that is stored, it's the actual value itself. Because of this Boolean values actually occupy 4 bytes of memory. Native types like doubles are stored in 2 x 4 bytes
A reference type like a string for example could be any size. It could also be very large. So what happens is the string is stored on the heap and a pointer is created and put on the stack so it can be found quickly. Either way, the combination offers a lot faster solution than a simple memory model.
"You get that on the big jobs."
|
|
|
|
|
Reason for my vote of one: (and I suspect for the others) Wrong. It is so completely wrong, that there is almost nothing in there that is actually correct.
I don't often give down votes, but I'm making an exception in this case!
Sorry, but you really need to go back to the beginning and start learning this stuff again.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I read Jeffrey Richter's book on CLR but I must have totally misunderstood what I was reading. Hopefully someone will explain the difference in this topic. At the moment I'm aware I've got it wrong. I just don't know why.
"You get that on the big jobs."
|
|
|
|
|
I understand what you are trying to say but I didn't have another choice and I thought this is the right place to ask that problem. I already excused for my question you consider non-advanced and unprofessional . I hope you realize why.
|
|
|
|
|
You do realise that OG wasn't addressing you don't you? What he was saying is that the answer you were given was wrong - not that you were stupid for asking the question. It's actually a pretty fair question, as the concepts are misunderstood, which you can see from the answers.
|
|
|
|
|
Yeah your right, I didn't recognize! Oops
|
|
|
|
|
No, no, you misunderstood - that was not directed at you or your question (which is a good, sensible question). That is why it was a reply to RobCroll and not to you, and why his answer is light grey, and yours is still blue.
His answer to your question was wrong in just about every respect, and what he said you should ignore - look at Dave Kreskowiak's answer which is much, much better. That is why I (and I suspect others) voted him down - the advice was bad. If you look at the bottom left corner of a message you will see a "rate this message" facility. Have a look at his answer: 1.71/5 (7 votes) indicating he has had seven ratings, and that they have generally been unhappy. A vote of one is a "this is bad", a vote of 5 is a "this is good". If your message has no votes, it is blue, if it is down voted, it goes grey. If it is upvoted it goes green.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
You're right! Thanks
|
|
|
|
|
You're welcome!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The stack is (NOT OPTIMIZED VERY FAST MEMORY!) just an area in memory where various values are stored in a Last In, First Out fashion. It's used to hold simple variable values, pointers to objects, parameters for methods calls, return addresses for returning control back to where a method was called from, ...
A heap is a block of memory that contains both free (reserved for your app but unused) memory and allocated objects such as buffers, class instances, strings, or other complex types.
|
|
|
|
|
This uesd to be a lot easier question to answer - the stack was a small bit of RAM pointed to by the CPU Stack Pointer (SP) register, which made it fast and easy to access. Every CALL instruction pushed the current values in all CPU registers onto the stack, then popped them back when the CALLed routine was finished to resume execution. The Heap was a block reserved in RAM by an application to hold and access run-time data. Now it's a bit more complex, but this[^] discussion puts it in perspective.
Will Rogers never met me.
|
|
|
|
|
|
Finally some one has answered!!!
|
|
|
|
|
Hello
I develop a simple desktop application of sales management.
In my application in shipment report have 4 parameter
Report View by
Invoice
Date
Buyer
Product
I used ratio button in form so user can chose only one parameter at a time to view report
now i want to use check boxes user can chose multiple parameter use at a time to view report
Can you please suggest me how i can do this in short coding
Hope I clear my query
Thanks
|
|
|
|
|
hi all , i use this code to fill datagrid with data from my database
private void btn_by_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection("Data Source=MS-TOSHIBA;Initial Catalog=dalily system;Integrated Security=True");
SqlCommand cmd = new SqlCommand("select place.name,place.address,place.telephone,place.website,place.email,place.info from place,subcateogry where place.subcat_id=subcateogry.id And subcateogry.name='" + subcat_comboBox.SelectedItem.ToString() + "' ", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
dt.Load(dr);
dataGridView1.DataSource = dt;
dr.Close();
con.Close();
}
now i want when i click on row
select coordinate_x & coordinate_y from place table where name is in row i clicked on
And store coordinate_x & coordinate_y as double
thanks in advance
|
|
|
|
|
Just stop posting the same question twice in a row. There's no need and you're not drawing any more attention to your question. You're drawing it to yourself and not in a good light either.
|
|
|
|
|
i don't want to do that but there is a problem with my browser so when i click post nothing happen so i think my question not posted
|
|
|
|
|
Then you can check to see if it has been posted before doing it again.
|
|
|
|
|
hey,
my company wrote an activeX DLL in VB6 few years back, and now i've been asked to run some tests with it.
since i dont have VB6 environment anymore, i thought it'll be best to try and make a simple C# program that will call the registered COM Dll.
to do that i copied the DLL into c:\windows\system32, used regsrv32 to register the DLL, restarted the computer and referenced to it from my project.
from there i tried working like i use to:
mydll.cMain obj = new mydll.cMain();
int res;
res = obj.SetHttpServer("www.test.com", 80);
res = obj.PingServer();
with the first method call (SetHttpServer) Everything worked fine,
on the second method call (PingServer) i keep on getting Error# 429 " ActiveX component can't create object".
i looked over the original VB class, and it seems pretty simple, it creates an HttpWebRequest object and requests a string from the webserver defined with the SetHttpServer.
What am i doing wrong?
Thank you
Alon
|
|
|
|
|
Does the .DLL have any dependencies that you didn't copy over??
Use this[^] to find out.
|
|
|
|
|
Hey Dave,
that was my first thought too,
my dll depends on MSVBVM60.DLL which uses other windows DLL..
since i use Windows 7 (or Windows xp sp3 in another computer i tried) i found the file already to be located at 'system32' folder.
do i need to register the msvbvm60 file as well?
|
|
|
|
|
No, it's already there and done.
|
|
|
|
|
I have the following two variables
[code]
bytes_per_pixelS = 2;
byte[] stbd_data = new byte[stbd_width * num_lines * bytes_per_pixelS];
Array pingDataArray = new ushort[stbd_width * num_lines];
[/code]
To assign stbd_data to pingDataArray, which one is correct, knowing that stbd_data array is twice as long as the pingDataArray....
[code]
for (int i = 0; i < stbd_width * num_lines; ++i)
{
pingDataArray.SetValue( BitConverter.ToUInt16 (stbd_data ,2*i),i);
} }
[/code]
or
[code]
for (int i = 0; i < stbd_width * num_lines; ++i)
{
pingDataArray.SetValue( BitConverter.ToUInt16 (stbd_data ,i),i);
}
[/code]
thanks
|
|
|
|
|
I'm having issue understanding how I can read XML from a webservice.
What webservice is sending back an object array that contains XmlAttribute and XmlElements within the array.
Most of what I am finding on how to parse an XML response they are either deserializing it and converting it to their custom class or they are loading from a file.
In my case I can't do neither since what is returned is an object[].
I'm not asking for code.. just some help to point me in the right direction on what process I should take for reading this information.
|
|
|
|
|
If the objects within the array are well-formed XML in strings, then you can use an XmlDocument and its LoadXml method then go from there.
But maybe you need to read up more on deserialization.
|
|
|
|