Stack is a well-known concept for me, but I haven't got any information about heap. 
Posted on 2008-09-19 03:50:58 by qlmi
A heap is a memory manager which internally employs a linked list and which supports defragmentation (heaps can Grow and Shrink on demand).

Your process contains one default Heap (known as the Process Heap) which you can use to allocate blocks of 'heap memory' ... but you can create more heaps if you wish to.

See HeapAlloc etc.
Posted on 2008-09-19 04:16:26 by Homer
To put things super-simply, a heap is just some amount of memory from which you can allocate blocks as needed. Now that you know this, you should read about how Windows manages heaps.
Posted on 2008-09-19 06:57:45 by ti_mo_n
Well if you are talking about data structure, a heap is a tree-based data structure. A example would be binary heap which could be used as a priority queue.
Posted on 2008-09-19 07:32:32 by roticv
To keep things simple:

When working with the stack, you can push and pop, or you can manage ESP yourself. But the important thing to keep in mind is that you can only ever "deallocate" the topmost element.

With Heap memory, you can deallocate any memory block, and the memory holes possibly left behind can be re-used for later allocations.

Internally, there's a zillion different ways to implement a heap memory manager. Linked-list approach homer talks about works, but is na´ve and doesn't give good performance. There's low-fragmentation heaps, (more or less) constant-time allocation for specific sizes, and tons of other things to do. For FireFox3, a lot of time was spent researching various allocators wrt. speed and fragmentation issues.
Posted on 2008-09-19 09:40:31 by f0dder
I only referred to the linked-list since its used for automatic garbage collection, and by api that 'walk' the heap objects (such as the defragment api).

How you manage objects you allocated in heap memory is up to you of course, however my suggestion would be that if the objects are small, you should be allocating entire pages of heap memory and using your own allocation scheme to chop them up into object-sized parcels. The heap defrag api are kinda bad, you can do better yourself at paged memory access and save on context switches too.
Posted on 2008-10-05 04:58:54 by Homer