Skip to main content
GameDev.net gamedev.net
🔒 Locked

Delphi memory managers

Started by ggs Oct 2, 2000 at 4:13 AM 7 replies 450+ views
Original Post
ggs
ggs
Hi, after coding a transparent memory monitor for the delphi5.0 memory manager I'm wondering how I could extend it to give me more information on memory leaks. Currently it has stack tracking of the location of the allocation (I'm using parts of JCL for this), logs memory allocations, on shutdown it dumps a list of memory still allocated and where it was allocated, the size, and a hex and raw dump of the memory in question. Are there and things in particular which I could add to enhance it? I did have some memory bounds checking but that generated some errors but i think that was linked to the implementaion of the stack checking, I for got to initialize the strings So any advice on how I could make this a better library? Edit- I forgot that my debug stuff IS NOT thread safe Edited by - ggs on 10/2/00 4:26:00 AM
turbo
turbo
Just use snoop...

http://home.sprynet.com/~rrm/snoop.html

From the site -- "Writing programs that work at all is difficult enough without having to track down memory leaks and strange problems with overwritten memory. Snoop and Snoop Monitor make it easy to snoop out those bugs -- and they''re free."

[ turbo | turbo.gamedev.net ]
[ Michael Wilson | turbo sys-op | turbo.gamedev.net ]
LoreKeeper
LoreKeeper
Hey ggs

- I think it is commendable, that you are writing a Memory thingy. If you haven''t done so, check out "Ask Midnight" at flipcode for his version of memory managing, and finding leaks, and making the thing overally very useful.

He even mentions that his particular version finds problems that snoop didn''t manage to pick-up. And that it is great for reducing the memory requirements for a program in general.

hope it helps
A-Lore
ggs
ggs
I already have checked out the "Ask Midnight" thing and i''ll copy out the features. If turbo will host it I''ll release it there with full source once I get all the inter-dependants on my other code out.
So far my memory monitor can do every thing Snoop can, it has some other options as well and should detect almost all memory leaks. It is now thread safe as well.
LoreKeeper
LoreKeeper
YEEEES!!! Bring it on!!

*grinZ* - I''ve always been curious on how you actually do that kinda stuff. Oh pleeeeease turbo?? :D
ggs
ggs
I''ll email it to turbo as soon as i get some bugs out of the memory overrun feature, becides for that its about done for version 1.

Then in the next version I''ll replace how it manages the list of allocated objects, and add some features translated from the memory manager posted by "Ask Midnight"
ggs
ggs
I''ve emailed it of to turbo but I forgot to put a subject in...
I dont use email that much and I had to re-write the msg after my browser crashed.

LoreKeeper its not to hard to implement a memory manager under Delphi. The wonderful functions GetMemoryManager & SetMemoryManager mean you just have to write code to handle allocations, deallocations and reallocations. You dont have to worry about having to use a different new() or getmem()
turbo
turbo
It''s posted now


[ turbo | turbo.gamedev.net ]
[ Michael Wilson | turbo sys-op | turbo.gamedev.net ]
LoreKeeper
LoreKeeper
Hey ggs!! Thanks alot...

Now how about a nice example app? Ideally one, where we can see how the memory manager can be used to find an error in that app?

*GrinZ* - I know... I''m reckless and demanding. LOL!!

A-Lore

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.