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

C#

 
GeneralRe: Problem with windows form [modified] Pin
JelleM29-May-06 3:22
JelleM29-May-06 3:22 
QuestionUrgent When i m going to inherit from one form from another form Pin
Shiv529-May-06 2:22
Shiv529-May-06 2:22 
QuestionI got error when inherit one form from other using CV Pin
Shiv529-May-06 2:20
Shiv529-May-06 2:20 
QuestionEvent Initialize Pin
JacquesDP29-May-06 2:06
JacquesDP29-May-06 2:06 
AnswerRe: Event Initialize Pin
stancrm29-May-06 2:39
stancrm29-May-06 2:39 
GeneralRe: Event Initialize Pin
JacquesDP29-May-06 3:00
JacquesDP29-May-06 3:00 
QuestionMemory allocation help Pin
eric_tran29-May-06 1:16
eric_tran29-May-06 1:16 
AnswerRe: Memory allocation help [modified] Pin
Guffa29-May-06 3:31
Guffa29-May-06 3:31 
The .NET heap doesn't work that way.

You create an object, for instance an array of byte, and the space for the object is allocated on the heap. If you want to treat the data area of the object as a memory area, you have to use the fixed keyword to pin the object at the same address, otherwise the garbage collector may move the object at any time.

Example:
// create an array
byte[] b = new byte[1000];
// unsafe context to use pointers
unsafe {
   // pin the array in memory
   fixed (byte* p = b) {
      // fill the array
      byte* pp = p;
      for (int i=0; i<1000; i++) {
         *pp++ = 42;
      }
   }
   // outside fixed - the array may move again
}



---
b { font-weight: normal; }


-- modified at 9:37 Monday 29th May, 2006
GeneralRe: Memory allocation help [modified] Pin
eric_tran29-May-06 3:44
eric_tran29-May-06 3:44 
AnswerRe: Memory allocation help [modified] Pin
Guffa29-May-06 5:17
Guffa29-May-06 5:17 
GeneralRe: Memory allocation help [modified] Pin
eric_tran29-May-06 5:24
eric_tran29-May-06 5:24 
GeneralRe: Memory allocation help Pin
S. Senthil Kumar29-May-06 19:39
S. Senthil Kumar29-May-06 19:39 
GeneralRe: Memory allocation help Pin
Guffa29-May-06 22:49
Guffa29-May-06 22:49 
GeneralRe: Memory allocation help Pin
S. Senthil Kumar30-May-06 1:12
S. Senthil Kumar30-May-06 1:12 
Questioncommad Promt problem[modified] Pin
Support12329-May-06 1:05
Support12329-May-06 1:05 
AnswerRe: hi all Pin
Support12329-May-06 1:18
Support12329-May-06 1:18 
GeneralRe: hi all Pin
lmoelleb29-May-06 1:30
lmoelleb29-May-06 1:30 
GeneralRe: hi all Pin
Support12329-May-06 1:37
Support12329-May-06 1:37 
Questiona question about displaying time ? Pin
cmpeng3429-May-06 0:46
cmpeng3429-May-06 0:46 
AnswerRe: a question about displaying time ? [modified] Pin
rah_sin29-May-06 0:52
professionalrah_sin29-May-06 0:52 
QuestionVideo Preview in Fullscreen problem Pin
ranandbe29-May-06 0:36
ranandbe29-May-06 0:36 
Questionarray type at runtime Pin
thepersonof29-May-06 0:07
thepersonof29-May-06 0:07 
AnswerRe: array type at runtime Pin
S. Senthil Kumar29-May-06 0:13
S. Senthil Kumar29-May-06 0:13 
GeneralRe: array type at runtime [modified] Pin
thepersonof29-May-06 1:23
thepersonof29-May-06 1:23 
GeneralRe: array type at runtime Pin
S. Senthil Kumar29-May-06 19:41
S. Senthil Kumar29-May-06 19:41 

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.