just a few small questions

clayasaurus clayasaurus at gmail.com
Mon Apr 17 19:30:12 PDT 2006


MM wrote:
>> I need to read alot of blocks(rectangles if seen as a plane) out of it like.
>> Is this way then the fastest implementaion?
>> And how much can I take from the heap without problems?
>>
> 
> I'm sorry to for ask attention... but I really need some help here :(
> I just need one global array which is read like I said and one every few minutes
> filled with different data... is the stack the best place for this kind of data?
> 

I would tend to use the heap for large sets of data and the stack for 
local variables that you use only in the scope you use it in.

I think you are best off using the heap for your large global array. 
Data placed on the heap stays there until you explicitly delete it, so 
you don't have to use a global. Heap is also what you use if you have 
any sort of dynamic memory needs, you can allocate what you need when 
you need it. If you use new/delete to much, the heap may become 
segmented and then the garbage collector will run (I think). The heap is 
unlimited for the most part, while you can only allocate so much data 
onto the stack. The heap might be slower to access, but not enough to be 
a significant problem.

Maybe an expert can vindicate my post?
~ Clay



More information about the Digitalmars-d-learn mailing list