Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c++ - How to implement a memory heap -


wasn't sure how phrase title, question is:

i've heard of programmers allocating large section of contiguous memory @ start of program , dealing out necessary. in contrast going os every time memory needed. i've heard faster because avoid cost of asking os contiguous blocks of memory constantly.

i believe jvm this, maintaining own section of memory , allocating objects that.

my question is, how 1 implement this?

thanks, dragonwrenn

most c , c++ compilers provide heap memory-manager part of standard library, don't need @ in order avoid hitting os every request.

if want improve performance, there number of improved allocators around can link , go. e.g. hoard, wheaties mentioned in now-deleted answer (which quite -- wheaties, why'd delete it?).

if want write own heap manager learning exercise, here basic things needs do:

  • request big block of memory os
  • keep linked list of free blocks
  • when allocation request comes in:
    • search list block that's big enough requested size plus book-keeping variables stored alongside.
    • split off big enough chunk of block current request, put rest in free list
    • if no block big enough, go os , ask big chunk
  • when deallocation request comes in
    • read header find out size
    • add newly freed block onto free list
    • optionally, see if memory following listed on free list, , combine both adjacent blocks 1 bigger 1 (called coalescing heap)

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -