🔒 Locked
memory allocation
Advertisement
Original Post
Hello,
Since long time ago, I heard everywhere that memory allocation is very slow.
how much slow really it is ?(more than a division? sqrt?).
Thanks
I''ve written a small test app to check how slow (or fast) mem allocation is. It allocates 10MB of memory and frees it again. Doing this in a 1000-times-loop takes about 1790 miliseconds on my K6-iii@450 with 192ram.
I think memory allocation is not so time consuming, as long as it doesn''t have to use virtual memory.
(I''ve also noticed that there is a _huge_ difference in speed between the ''release'' and ''debug'' build. But actually I was too impatient to wait for the debug version to success
)
===========================
UNKNOWN caused an invalid page fault in module unknown at 0000:bff80eb6
: win98 with multiple sclerose
I think memory allocation is not so time consuming, as long as it doesn''t have to use virtual memory.
(I''ve also noticed that there is a _huge_ difference in speed between the ''release'' and ''debug'' build. But actually I was too impatient to wait for the debug version to success
===========================
UNKNOWN caused an invalid page fault in module unknown at 0000:bff80eb6
: win98 with multiple sclerose
quote:
Original post by siaspete
In debug mode, the processor is spending much of the time filling that 10mb block with 0xCDCDCDCD ;-)
:D, or even 0x42696C6C, lol
===========================
UNKNOWN caused an invalid page fault in module unknown at 0000:bff80eb6
: win98 with multiple sclerose
What about
0xdeadbeef?quote:
Original post by SwSh
I''ve written a small test app to check how slow (or fast) mem allocation is. It allocates 10MB of memory and frees it again. Doing this in a 1000-times-loop takes about 1790 miliseconds on my K6-iii@450 with 192ram.
This doesn''t sound like it models anything from the real-world, so the resultant figures are likely to be meaningless.
I would say that memory allocation depends on "memory allocation list". If u allocating & freeing lot of 1Mb blocks, then it will take ( probably ) more time for finding enough space for 10Mb block. This is because, system will scan ( probably ) all pointers to free memory blocks & if all memory is consists of 1Mb blocks OS should unit them in one. Realloc() is trying to defragment memory, so sometimes it is good idea to use it 
I''m not 100% sure for windows, but in DOS it was working this way...
Lekha
I''m not 100% sure for windows, but in DOS it was working this way...
Lekha
Ok, you''re right. But it was only to show the order of magnitude.
Oh well, I''ve made another test and it took the computer about 4700ms to calculate 1000000000 sqrt''s. (with doubles)
(I had to put one _asm{nop} inside the loop, but it doesn''t slow down so much)
===========================
UNKNOWN caused an invalid page fault in module unknown at 0000:bff80eb6
: win98 with multiple sclerose
Oh well, I''ve made another test and it took the computer about 4700ms to calculate 1000000000 sqrt''s. (with doubles)
(I had to put one _asm{nop} inside the loop, but it doesn''t slow down so much)
===========================
UNKNOWN caused an invalid page fault in module unknown at 0000:bff80eb6
: win98 with multiple sclerose
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement