allocating a large array

  • Thread starter Thread starter A.User
  • Start date Start date
A

A.User

I am trying to allocate large byte array (~32meg) and I keep getting "out of
memory errors"
I tested C# app on PC and of course it works fine.
When trying to run on CE.Net 4.1 emulator it chokes(out of memory).
Even when I set the the memory for the emulator to
256M (PC has 1Geg memory) Control Panel->system-> memory only shows ~25M
available????
Changing memory setting to 256/128 or 64M all show avalable memory at ~25M
in control panel.
On my actual targeted device (Xscale) I have 128M ram and Control
Panel->system->memory does show
~54Meg available for apps.... but I still get out of memory errors.
If I cut byte array allocation back to arround 18M it works and memory
status shows it being consumed
and released when app closes.
Is there some other internal limit I am hitting???
 
Each process only gets a total memory space of 32MB under Windows CE. I can
understand why it wouldn't work to allocate that whole area to a single
object.

Why do you need that huge a byte array?

Paul T.
 
I do seem to remember this now that you mention it.
I am trying to write a Flash update program. I would like
to read in and parse the whole image file (.bin) before committing to flash
(~30meg).
I know I could "chunk" it, and there are probably other option but I prefer
reading
everything in one fell swoop.
I seem to remember there is something in CE that allows you to get at
physical memory kind
of in a "linear" mode. May require P/Invoke to get at.
Do you recall? Maybe I should post in Platform Builder NG?
 
CreateFileMapping is the function.



A.User said:
I do seem to remember this now that you mention it.
I am trying to write a Flash update program. I would like
to read in and parse the whole image file (.bin) before committing to flash
(~30meg).
I know I could "chunk" it, and there are probably other option but I prefer
reading
everything in one fell swoop.
I seem to remember there is something in CE that allows you to get at
physical memory kind
of in a "linear" mode. May require P/Invoke to get at.
Do you recall? Maybe I should post in Platform Builder NG?
 
Yes, you can do that. It allocates memory from address space in an area
that is not process-specific.

Paul T.
 
Back
Top