View unanswered posts | View active topics It is currently July 24th, 2017, 9:50 am



Reply to topic  [ 5 posts ] 
 SetMinimumBlockAlignment support? 
Author Message

Joined: September 15th, 2010, 1:36 pm
Posts: 4
Post SetMinimumBlockAlignment support?
Hi,

I tried to replace the DLL, and it works, but I don't know yet if it's by luck or by design.
Basically, I require SetMinimumBlockAlignment(mba16Byte) for my app to run, and using ShareMem makes my app crash, most likely because Delphi's shared mem manager DLL only aligns to 8 bytes, which is FastMM's default.

However, using TBBMM, it works. I would like to think that this is because Intel isn't stuck to the past and they align all blocks to 16bytes, but is this confirmed anywhere? I gave a quick look at the mem management part in TBB's help, it seems like you can possibly ask which alignment you want when allocating - is this done in the DLL wrapping TBBMM?

Thanks


September 15th, 2010, 1:42 pm
Profile
Site Admin

Joined: July 4th, 2008, 2:56 pm
Posts: 226
Post Re: SetMinimumBlockAlignment support?
TBBMM's wrapper is built using the default settings of TBB - it calls TBB's scalable_malloc. I don't know if it is aligned to 16 bytes by default.


September 17th, 2010, 1:50 am
Profile

Joined: September 15th, 2010, 1:36 pm
Posts: 4
Post Re: SetMinimumBlockAlignment support?
Mmh I did a quick test, sadly for small blocks it only seems to align to 8.

Are the sources for the wrapper available?
A simple replacement to scalable_aligned_malloc/scalable_aligned_free/scalable_aligned_realloc should fix this, and then guarantee full compatibility with FastMM's max alignment (16).


September 17th, 2010, 3:46 am
Profile
Site Admin

Joined: July 4th, 2008, 2:56 pm
Posts: 226
Post Re: SetMinimumBlockAlignment support?
TBBMM.dll only exports the non-aligned functions though. I'll need to get it rebuilt to support aligned calls - that applies for Borlndmm.dll as well.


September 17th, 2010, 4:03 pm
Profile

Joined: September 15th, 2010, 1:36 pm
Posts: 4
Post Re: SetMinimumBlockAlignment support?
Indeed, it doesn't seem to be exported.

I also realized I can't actually use it in this form, I'm doing plugins & the host might be unknown, meaning that it could happen that the host or an already loaded plugin was made in Delphi & using another ShareMem.dll loaded in the process, the old one, as it doesn't seem possible to specify a path to ShareMem (also related to that (arguable) "Windows DLL exploit" that's being talked so much recently btw).

Was the wrapper tricky? I'm thinking of simply replacing the local, non-shared mem manager by wrapping. Since apparently v3 is releasing memory, having DLL plugins NOT sharing it (actually, they would still be sharing tbbmm.dll unless linked with a path, just not borlndmm.dll) would still be ok. Unless there's already a plugin using a v2 tbbmm.dll already. Mmmh..
The whole problem is there, I'm quite sure that Windows picks whatever of the same name is already loaded in the process, even if the DLL in the owner's folder is a different one, as the DLL search process is said to be happening if it's not already in the process.


September 17th, 2010, 9:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB.