objective c - How to let a C-array always to be accessed from disk directly instead of remaining in memory? -



objective c - How to let a C-array always to be accessed from disk directly instead of remaining in memory? -

i'm trying embed binary media resources source code. going utilize plain c-array (char[]) store binary. (with this: embedding binary blobs using gcc mingw) because managing media files resource separately annoying work because symbol hard determined @ compile time, , makes customers annoying too.

anyway i'm concerning memory consuming. if store png image, actually, don't need persistent binary anymore after loaded live image instance (uiimage*) it. think persistent binary remain in memory because

it's part of code and it's constant.

i don't know alternative remove memory.

how can let c-array accessed disk straight instead of remaining in memory?

ps. can limit build , execution environment strictly. utilize clang , programme run on ios. anyway don't mind utilize of build tool :)

i don't understand saying or trying solve, sounds looking memory mapping. see man mmap.

ps reading again, if understand question correctly, want create fat binary containing resource data. in case, os page out unused parts of it, memory "freed" automatically. ("freed" in sense of releasing physical memory can used other purposes) persistant binary will remain in virtual memory, not in physical memory.

update explain little further

on mac, in terminal, run

$ vmmap -resident $$

this show virtual memory mapping shell, showing total memory , resident memory. see line:

==== non-writable regions process 7139 __text 0100000000-00100099000 [ 612k 460k] r-x/rwx sm=cow /bin/bash

this says, in part of memory file /bin/bash found (memory mapped, again, see man mmap) , not paged in; 460kb of binary nowadays in memory. interesting because binary running. other lines interesting well, beyond scope of question.

so if os of selection (ios) has sane memory management, problem not exist. don't touch memory don't need use; every time touch it, pages read in memory.

objective-c c ios arrays memory

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -