Click here to Skip to main content
15,913,722 members
Home / Discussions / C#
   

C#

 
GeneralRe: Stack overflow problem. Pin
spainchaud24-Apr-10 8:31
spainchaud24-Apr-10 8:31 
GeneralRe: Stack overflow problem. Pin
harold aptroot24-Apr-10 8:48
harold aptroot24-Apr-10 8:48 
GeneralRe: Stack overflow problem. Pin
spainchaud24-Apr-10 9:28
spainchaud24-Apr-10 9:28 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn24-Apr-10 9:06
sitebuilderLuc Pattyn24-Apr-10 9:06 
GeneralRe: Stack overflow problem. Pin
spainchaud24-Apr-10 9:50
spainchaud24-Apr-10 9:50 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn24-Apr-10 9:56
sitebuilderLuc Pattyn24-Apr-10 9:56 
GeneralRe: Stack overflow problem. Pin
spainchaud24-Apr-10 10:21
spainchaud24-Apr-10 10:21 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn24-Apr-10 10:34
sitebuilderLuc Pattyn24-Apr-10 10:34 
Yes, the garbage collector "GC" (part of which runs on its own thread) may move around objects, and does so asynchronously to your own code execution; the managed world knows how to deal with that, unmanaged code does not. By using fixed or GCHandleType.Pinned you prevent such moves.

Warning: pinned objects temporarily reduce the GC's capabilities, so you should not keep objects pinned longer than necessary.

I suspect your code currently works for small arrays and not for larger ones because the automatic marshaling is somehow limited (maybe it does allocate a temp array on stack??); I do not know any details as I try to not rely on it (I do trust it when strings are involved and an ASCII/Unicode conversion may be in order).

I have been marshaling arrays of 100MB+ without any problem; once you get the hang of it, it works like a charm. I have lots of code in C (and SIMD assembly) that gets called to operate on managed objects, such as huge images.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.


GeneralRe: Stack overflow problem. Pin
DaveyM6924-Apr-10 23:07
professionalDaveyM6924-Apr-10 23:07 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn25-Apr-10 1:33
sitebuilderLuc Pattyn25-Apr-10 1:33 
GeneralRe: Stack overflow problem. Pin
DaveyM6925-Apr-10 3:48
professionalDaveyM6925-Apr-10 3:48 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn25-Apr-10 4:05
sitebuilderLuc Pattyn25-Apr-10 4:05 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn25-Apr-10 4:02
sitebuilderLuc Pattyn25-Apr-10 4:02 
AnswerRe: Stack overflow problem. Pin
Luc Pattyn24-Apr-10 1:44
sitebuilderLuc Pattyn24-Apr-10 1:44 
GeneralRe: Stack overflow problem. Pin
spainchaud24-Apr-10 8:05
spainchaud24-Apr-10 8:05 
GeneralRe: Stack overflow problem. Pin
Luc Pattyn25-Apr-10 4:04
sitebuilderLuc Pattyn25-Apr-10 4:04 
GeneralRe: Stack overflow problem. Pin
spainchaud25-Apr-10 18:57
spainchaud25-Apr-10 18:57 
AnswerRe: Stack overflow problem. Pin
spainchaud26-Apr-10 4:42
spainchaud26-Apr-10 4:42 
QuestionGenerating array in foreach loop Pin
mprice21423-Apr-10 18:11
mprice21423-Apr-10 18:11 
AnswerRe: Generating array in foreach loop Pin
Khaniya23-Apr-10 18:25
professionalKhaniya23-Apr-10 18:25 
GeneralRe: Generating array in foreach loop Pin
mprice21423-Apr-10 18:52
mprice21423-Apr-10 18:52 
AnswerRe: Generating array in foreach loop Pin
dan!sh 23-Apr-10 18:42
professional dan!sh 23-Apr-10 18:42 
GeneralRe: Generating array in foreach loop Pin
mprice21423-Apr-10 18:53
mprice21423-Apr-10 18:53 
AnswerRe: Generating array in foreach loop Pin
PIEBALDconsult24-Apr-10 4:12
mvePIEBALDconsult24-Apr-10 4:12 
GeneralRe: Generating array in foreach loop Pin
mprice21424-Apr-10 13:27
mprice21424-Apr-10 13:27 

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.