0

I have a memory intensive application loading and unloading large images that crashes due to Memory allocation failure.

I'd like to try the heap separation method to solve this. Set one area for images and another for all the rest which tend to be small objects.

I found windows API functions such as HeapAlloc\HeapCreate but I'm not sure this is the way to go. What's the best way to tackle this?

2 Answers 2

1

I have used HeapAlloc\HeapCreate before with success, also for large objects (>20Mb I believe). But that was for keeping objects in separate heaps for debugging memory problems. In recent versions of windows the Low fragmentation heap should be the default. So I am surprised that you get yours to fragment. Maybe you suffer from this: LFH disabled? What is the largest size for a single allocation?

Sign up to request clarification or add additional context in comments.

1 Comment

How did you decide on initial and max sizes for your heap?
0

If you have a memory intensive aplication (allocationg huge memory chunks), you should definitely look at VirtualAlloc first.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.