# Discarding pmap’s results (pforeach?)

**URL:** https://discourse.julialang.org/t/discarding-pmap-s-results-pforeach/101452
**Category:** General Usage
**Tags:** pmap
**Created:** [July 10, 2023, 8:37pm UTC](https://discourse.julialang.org/t/discarding-pmap-s-results-pforeach/101452 "2023-07-10T20:37:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lmtzx9h4qqnt](https://avatars.discourse-cdn.com/v4/letter/l/74df32/32.png) [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)
#### Post date: [July 10, 2023, 8:37pm UTC](https://discourse.julialang.org/t/discarding-pmap-s-results-pforeach/101452/1 "2023-07-10T20:37:59Z")

</div>

I was wondering what the best way to use `pmap` (or something equivalent) is when I just want to do some operations in parallel without collecting any results in memory. Silly example:

```julia
julia> pmap(x -> println(x), 1:10)
1
2
3
4
5
6
7
8
9
10
10-element Vector{Nothing}:
 nothing
 nothing
 nothing
 nothing
 nothing
 nothing
 nothing
 nothing
 nothing
 nothing

```

Here, I get a `Vector{Nothing}` that I’m not actually interested in. It seems like this doesn’t actually use extra memory, even when it has a lot of elements. Is it true that a `Vector{Nothing}` uses constant memory independent of its length?

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [July 10, 2023, 8:45pm UTC](https://discourse.julialang.org/t/discarding-pmap-s-results-pforeach/101452/2 "2023-07-10T20:45:45Z")

</div>

See also `Threads.foreach`

---

<div class="post-metadata">

### Author: ![lmtzx9h4qqnt](https://avatars.discourse-cdn.com/v4/letter/l/74df32/32.png) [@lmtzx9h4qqnt](https://discourse.julialang.org/u/lmtzx9h4qqnt)
#### Post date: [July 10, 2023, 8:56pm UTC](https://discourse.julialang.org/t/discarding-pmap-s-results-pforeach/101452/3 "2023-07-10T20:56:46Z")

</div>

Yeah, something like that. But `Threads.foreach` is (presumably) only within a single process. So I suppose I’m looking for a `pforeach`?
