News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Adventures in programming: Treeviews, directory scanning, recursion

Started by NoCforMe, April 05, 2024, 10:36:19 AM

Previous topic - Next topic

sinsi

Here's one example of what happend if we don't clean up after ourselves  :biggrin:
exit99: invoke FindClose,findHandle ;<<add this and all is good
   REt
🍺🍺🍺

NoCforMe

Quote from: sinsi on April 08, 2024, 11:51:36 AMHere's one example of what happend if we don't clean up after ourselves  :biggrin:
exit99:    invoke FindClose,findHandle ;<<add this and all is good
  REt

You dog you. You dirty dog.

That did it. Memory goes up to ~20 MB, stays there.

I had no idea that function even existed. (Probably a holdover from my old DOS days; "Back then we didn't have to close no find handles!")

Thanks!
Assembly language programming should be fun. That's why I do it.

NoCforMe

Well, it's been real. It is now time to put this project aside. I talked to my friend today, and it turns out they had something completely different in mind. So I've turned this into a simple picture viewer; I've come to like it in this function. Nice way to browse through pictures on disk. (And I learned how to use a new control.)

So thanks to all who helped on this. On to the next project!
Assembly language programming should be fun. That's why I do it.

lingo

Thank you NoCforMe,

It is my very old 32bits Dirs Tree View from:
https://www.masmforum.com/board/index.php?topic=16421.msg143124

Pls, try to open \Windows\winsxs with your program, after that  with my dt.exe.
See the different times....   :biggrin:
Quid sit futurum cras fuge quaerere.

jj2007

Quote from: lingo on April 08, 2024, 10:20:57 PMPls, try to open \Windows\winsxs with your program, after that  with my dt.exe.
See the different times...

Yep, that is clever: the first algo has to load all the files into the cache, then the second one kicks in and does it in milliseconds :thumbsup:

lingo

Put a stop to that nonsense, will you? :nie:

1. Start one program , test it against \Windows\winsxs
2. Restart Windows to clean the cache
3. Start next program , test it against \Windows\winsxs.
Quid sit futurum cras fuge quaerere.

jj2007

Quote from: lingo on April 08, 2024, 10:20:57 PMIt is my very old 32bits Dirs Tree View from:
https://www.masmforum.com/board/index.php?topic=16421.msg143124

Where are the attachments? I can't see any. I'd like to see the source.

lingo

https://www.masmforum.com/board/index.php?topic=16421.msg143124
post  #39
Quid sit futurum cras fuge quaerere.

jj2007

Compliments, that code is fast indeed :thumbsup:

June 2000: Is there a Zw() routine like FindFirstFile()? Try to use ZwQueryDirectoryFile routine.

Jan 12, 2011: There are NT API functions (ZwQueryDirectoryFile and similar), which are called by FindFirstFile


NoCforMe

Back to my project.

Now I need help with memory allocation. I'm trying to implement incremental allocations so I don't have to fail with a stupid message like "I've hit my limit of 100,000 folders + files".

I tried using HeapReAlloc() to do this, and it failed, because (I think) the new allocation address was different from the original one. In any case, I'm not sure this is even the appropriate route to take to allocation. (So far in my programming experience I've only ever used heap allocation to get memory.)

First of all, even if I could use HeapAlloc() and friends, I'm not sure I could get enough memory. I'm a bit confused by this statement in the Micro$oft docs for this function:
QuoteIf the heap specified by the hHeap parameter is a "non-growable" heap, dwBytes must be less than 0x7FFF8. You create a non-growable heap by calling the HeapCreate function with a nonzero value.
Which means the maximum allocation would be 524,280 bytes, not enough for my purposes.

But is it possible to create a "growable" heap? and if so, would you create such a heap by making a zero allocation first? That isn't clear at all.

So what I would like, if possible, would be an allocation method that always returns the allocated block at the same memory location. Otherwise it would be a nightmare, as all of my pointers in that file list would become invalid.

Looking at this page, I see there are the following flavors of memory allocation:
  • AWE
  • Heap
  • Virtual memory
  • Global and local
  • Enclave

My requirements (or at least my wish list):
  • Large allocations (~20 MB per chunk, up to maybe 1/2 GB?)
  • Allocation remains at the same address

So which flavor should I be using?

Further testing here at NoC Laboratories, GmbH reveals that a HeapReAlloc() does use the same address as the original allocation. The problem is I hit the size limit (7FFF8h). So HeapXXXX() seems to be out as a choice for me.
Assembly language programming should be fun. That's why I do it.

daydreamer

Quote from: sinsi on April 07, 2024, 03:49:10 PM
QuoteFirst of all, daydreamer, you really need to learn to write coherent English. It's sometimes very difficult to figure out what you're trying to say.
Don't be a dick. You don't use emojis, which makes some of your posts dick-ish :rolleyes:
Sorry,sometimes i post from old phone browser :( with problem using the boards emojis
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

About what kind of memory to use,what kind of memory allocation is under the hood of c linked list code that reallocate to bigger memory when you add nodes ?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

NoCforMe

Quote from: daydreamer on April 09, 2024, 05:19:41 AMAbout what kind of memory to use,what kind of memory allocation is under the hood of c linked list code that reallocate to bigger memory when you add nodes ?
Good question, the answer to which might be the answer I'm looking for.
Assembly language programming should be fun. That's why I do it.

jj2007


NoCforMe

So how do I access the "default heap"? And what about that note that says the allocation is limited to 7FFF8h bytes? (I just ran up against that limit.) And what about "non-growable" vs. grow-able heaps?
Assembly language programming should be fun. That's why I do it.